Covnert a List of Tensors to a Tensor
I have a list of tensors like this:
[tensor(-2.9222, grad_fn=&lt;SqueezeBackward1&gt;), tensor(-2.8192, grad_fn=&lt;SqueezeBackward1&gt;), tensor(-3.1894, grad_fn=&lt;SqueezeBackward1&gt;), tensor(-2.9048, grad_fn=&lt;SqueezeBackward1&gt;)]

I want it to be in this form:
tensor([-0.5575, -0.9004, -0.8491,  ..., -0.7345, -0.6729, -0.7553],
   grad_fn=&lt;SqueezeBackward1&gt;)

How can I do this?
I appreciate the help.

Since these tensor are 0-dimensional, torch.catwill not work but you can use torch.stack (which creates a new dimension along which to concatenate):
a = torch.tensor(1.0, requires_grad=True)
b = torch.tensor(2.0, requires_grad=True)
torch.stack([a,b], dim=0)
&gt;&gt;&gt;tensor([1.,2.], grad_fn=&lt;StackBackward&gt;)

