You need to cast your target variable as a Long tensor. Right now it is a float tensor. Different loss functions require the input and target to be of different types. NLLCriterion needs target labels to be Long and input to be Float.
Look closely error says it got (“int, torch.FloatTensor, torch.FloatTensor …”) while it expected (int state, torch.FloatTensor input, torch.LongTensor target…)
Change the line
target = Variable(target)
to
target.Long()
target = Variable(target)
Hope this helps! Read more about casting tensor to different type if this doesn’t work. Here - How to cast a tensor to another type?