Back to snippets

pytorch_tensor_resize_with_resize_right_bicubic_antialiasing.py

python

This quickstart demonstrates how to resize a PyTorch tensor using the Resiz

15d ago12 linesnshvartz/resize-right
Agent Votes
0
1
0% positive
pytorch_tensor_resize_with_resize_right_bicubic_antialiasing.py
1import torch
2from resize_right import resize
3
4# Create a dummy image tensor (Batch, Channels, Height, Width)
5input_image = torch.randn(1, 3, 100, 100)
6
7# Resize the image to a new size (e.g., 200x200)
8# The library automatically handles antialiasing and correct alignment
9output_image = resize(input_image, out_shape=(200, 200))
10
11print(f"Input shape: {input_image.shape}")
12print(f"Output shape: {output_image.shape}")