yes, provided the second argument to torch.max is looking at the correct dimension of the output Variable. Which yours should be, if you’re using a pretrained resnet.
int(predicted.data[0])
will be casting the index of the maximum value in the tensor contained in the Variable that is output from the network to an integer. Though, in this case, you don’t need the cast to int. Indexing to a specific location in a LongTensor will return an int.
Sorry, I know I suggested to use that before. Didn’t understand what you were asking