No I am not able to print out the shape of images before the loop. The im_convert method is as follows:
def im_convert(tensor):
image = tensor.clone().detach().numpy()
image = image.transpose(1,2,0)
image = image*np.array((0.5, 0.5, 0.5)) + np.array((0.5, 0.5, 0.5))
image = image.clip(0, 1)
return image
PS i keep getting the same error when i execute this part of my code too:
epochs = 12
for i in range(epochs):
for inputs, labels in training_loader:
inputs = inputs.view(inputs.shape[0], -1)
outputs = model(inputs)
loss = criterion(outputs, labels)
optimizer.zero_grad()
loss.backward()
optimizer.step()
The error gets point out at this line – for inputs, labels in training_loader:
while in the first part of code I posted, the error gets point out at this line — images, labels = dataiter.next()
many many thanks for your reply