Although I can do Binary classification and multiple classification with success. But I am curious with the following error.
When I set the types of features and labels to be the same, for example torch.FloatTensor, and use nn.CrossEntropyLoss to calculate loss. I get the following error:
> /Users/Natsume/miniconda2/envs/experiment3.5/lib/python3.5/site-packages/torch/nn/_functions/thnn/auto.py(47)

  29         @staticmethod
  30         def forward(ctx, input, target, *args):
  31             ctx._backend = type2backend[type(input)]
  32             ctx.save_for_backward(input, target)
  33             if weight_arg_idx >= 0:
  34                 ctx.weight = args[0]
  35                 args = args[1:]
  36                 ctx.additional_args = list(args)
  37                 insert_idx = weight_arg_idx - 4  # state, input, target, output
  38                 ctx.additional_args.insert(insert_idx, ctx.weight)
  39             else:
  40                 ctx.additional_args = list(args)
  41
  42             ctx.forward_args_count = len(ctx.additional_args)
  43             for idx in buffers_idx:
  44                 ctx.additional_args.insert(idx, input.new(1))
  45             output = input.new(1)
  46             getattr(ctx._backend, update_output.name)(ctx._backend.library_state, in
  47  ->                                                   output, *ctx.additional_args)
  48             return output
 TypeError: FloatClassNLLCriterion_updateOutput received an invalid combination of arguments - got (int, torch.FloatTensor, torch.FloatTensor, torch.FloatTensor, bool, NoneType, torch.FloatTensor, int), but expected (int state, torch.FloatTensor input, torch.LongTensor target, torch.FloatTensor output, bool sizeAverage, [torch.FloatTensor weights or None], torch.FloatTensor total_weight, int ignore_index)

It seems the solution is to change targets type from torch.FloatTensor to torch.LongTensor. However, I could not find out which function generated this error message above. I wonder where is the function for generating the error message.
Thanks!