Hi there,
I am a new learner to Pytorch. I am trying to customize my first Pytorch model. Currently, I am stuck in the normalization part. My codes are:

problem_1934×375 47 KB

and the error I got is:

File “/home/wei/anaconda3/lib/python3.7/site-packages/torch/nn/functional.py”, line 3045, in normalize
denom = input.norm(p, dim, True).clamp_min(eps).expand_as(input)
AttributeError: ‘dict’ object has no attribute ‘norm’

The rescale, randomcorp and ToTensor parts all work very well. I know the problem is about the input. It should not be in a dict format. But I just have no idea how to fix it…
The reason I did not use “transforms.Normalize”, it’s because it also reports errors:

File “/home/wei/anaconda3/lib/python3.7/site-packages/torchvision/transforms/functional.py”, line 210, in normalize
raise TypeError(‘tensor is not a torch image.’)
TypeError: tensor is not a torch image.

I just copied the "Class Normalize(object)"codes from: [https://pytorch.org/docs/stable/_modules/torchvision/transforms/transforms.html#Normalize 3](source codes) into my MyUtils.py file with Rescale, RandomCrop, ToTensor together.
First time post, any help would highly appreciated!