This isn’t helpful, but this is  very similar to the question I asked a few hours ago.  The problem is there are no examples or on the web that use datasets that return more than one in a batch. (They’re all image dataloaders).  You’re not getting a tensor to pass through to the model, you’re getting a std::vector (C++'s way of spelling “list”) of examples, which are whatever’s returned by the get() function in your dataset class… which is probably type Example.
The only way I’ve been able to make progress so far is manually converting my “list of examples” into a tensor is manually for each batch, which has to be wildly inefficient.  In my case, each example from my dataset is a 2D tensor. the model expects a 3D tensor, so I was able to do this:
  		for (auto& batch : *data_loader) {
			std::vector<torch::Tensor> Xs_list, Ys_list;
		    std::transform(batch.begin(), batch.end(), std::back_inserter(Xs_list), [](auto &e) {return e.data;});
		    std::transform(batch.begin(), batch.end(), std::back_inserter(Ys_list), [](auto &e) {return e.target;});
			torch::Tensor X = torch::stack(Xs_list);
			torch::Tensor Y = torch::stack(Ys_list);

            optimizer.zero_grad();
      		torch::Tensor prediction = model->forward(X);

Maybe that will help point you towards an answer.
EDIT: After more poking, I finally got my network to train.  The above code is wrong, in that the torch::from_blob lines should be replaces with torch::stack(Xs_list).  I’m editing the code now to reflect that.