Solved by mhubii in post #2 
              
              
                Hello @arlecchino, 
that is because in most tutorials there is the torch::data::transforms::Stack<>() transform applied to the dataset. It converts your std::vector<torch::data::Example> into one Tensor. Check out the MNIST example, there you will find this line 
auto test_dataset = torch::data::dat…