Today I just do some simple calculation like
    total_node = 0
    correct_node = 0
    correct_node2 = 0 

    for  ....:
          correct_node += torch.sum(target_sequence == pred)
          correct_node2 += torch.sum(target_sequence == pred).data[0]

but I found that correct_node != correct_node2.
How could this happen?