Error after installing pytorch

Ive installed pytorch version below and tried running a piece of code which is producing the below error. Please help !!

Error log when I ran the code below:
File "D:\DREAM\pytorch\mycode\", line 15, in <module> transforms.toTensor(), AttributeError: module 'torchvision.transforms' has no attribute toTensor

Code used :
import torch

import torchvision

import torchvision.transforms as transforms

import torch.nn as nn

from import DataLoader

import torch torch.__version__

You have a typo and transforms.ToTensor() should work (note the capital T).

1 Like