I want to pull a batch of Variable to one Variable, or one Tensor?[ type = ‘list’ ----> type = ‘torch.LongTensor’] How can I deal with this problem.

4 Likes

You may want to use torch.stack and torch.squeeze in conjunction. The first converts a list of tensors to a single stacked tensor, and the latter removes all dimensions=1, thus making your data compact.

3 Likes