I want to realize the function about transferring tensor to image. The tensor is derived from the network and the size is [2, 21 ,400 ,400]. And then I utilize transforms.ToPILImage to convert the image. But I get error information about " raise ValueError(‘pic should be 2/3 dimensional. Got {} dimensions.’.format(pic.ndimension()))
ValueError: pic should be 2/3 dimensional. Got 4 dimensions."
And I’ve tried this dimensionality reduction method(squeeze), but it still doesn’t work.