Comments (1)
Just for reference: Each time that ToTensor()
is used with this torchvision.transforms.v2
module, following pops up:
/usr/local/lib/python3.10/dist-packages/torchvision/transforms/v2/_deprecated.py:43: UserWarning: The transform ToTensor()
is deprecated and will be removed in a future release. Instead, please use v2.Compose([v2.ToImage(), v2.ToDtype(torch.float32, scale=True)] warnings.warn(
Should we keep on using ToTensor()
? What is the alternative? I have made the following test and it seems that output tensors are not the same:
# TEST: Check transforms.ToTensor() and v2.ToImage() + v2.ToDtype(torch.float32,scale=True)
# torch version 2.1.0+cu118 and torchvision version 0.16.0+cu118
from torchvision.transforms import v2 # new
from torchvision import transforms # old
transform1 = transforms.ToTensor()
transform2 = transforms.Compose([
v2.ToImage(),
v2.ToDtype(torch.float32, scale=True)
])
img_path = "/content/data/pizza_steak_sushi/test/pizza/1152100.jpg"
img = Image.open(img_path)
first_transform = transform1(img)
second_transform = transform2(img)
torch.equal(first_transform,second_transform)
This outputs False
😞
from pytorch-deep-learning.
Related Issues (20)
- Installing Gradio as gd in PyTorch , issues with typing extensions ....
- TypeError: 'Tensor' object is not callable HOT 1
- Getting very less accuracy for Image HOT 1
- Unable to get Reproducibilty of Tensors on GPU | Exercises | PyTorch Fundamentals HOT 3
- Different inputs on Conv2d HOT 3
- 'tuple' object is not callable HOT 1
- 06-pytorch-transfer-learning: got some error in [3.2 Setting up a pretrained model] (torch:2.1.0+cu121, torchvision:0.16.0+cu121) HOT 3
- transformer encoder layer output deos not seem right!
- Broken Link in PyTorch Custom Datasets Notebook HOT 1
- Hey i just reviewed one part of code.
- HuggingFace Spaces Runtime Error
- Getting Started with Tensor flor - scalar.ndim HOT 1
- an error on Batching FashionMNIST figure
- TypeError: 'Tensor' object is not callable HOT 2
- Fix Code Error
- Less accuracy on local machine compare to Colab HOT 1
- The Markdown table formatting is incorrect HOT 1
- PyTorch
- 09 Model development: TypeError: AsyncConnectionPool.__init__() got an unexpected keyword argument 'socket_options'
- CIFAR 10 dataset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch-deep-learning.