New answers tagged


Since PyTorch version 1.10, nn.CrossEntropy() supports the so-called "soft’ (Using probabilistic) labels the only thing that you want to care about is that Input and Target has to have the same size.


I found the issue. if __name__ == "__main__": test_iter = Multi30k(split='test') test_dataloader = DataLoader(test_iter, batch_size=256) for epoch in range(1, 10): print('test_iter.current_pos_outer_loop: ', test_iter.current_pos) for (src, tgt) in test_dataloader: print('test_iter.current_pos: ', ...


In PyTorch a typical gotcha that leads to this behavior is forgetting to set the model in evaluation mode when doing inference. You can do this by invoking .eval() on the model. Evaluation mode changes the behavior of some stochastic elements that can lead to not deterministic results, like batch normalization and dropout. Apart from that, unless you have ...

Top 50 recent answers are included