What kind of criterion are you using? Based on the stack trace it seems you might be using a custom nn.Module? If so, could you check its expected arguments and make sure that both tensors are accepted?