Converting a list of tensors to numpy array

Suppose one has a list containing two tensors.
List = [tensor([[a1,b1], [a2,b2], …, [an,bn]]), tensor([c1, c2, …, cn])].
How does one convert the list into a numpy array (n by 3) where the corresponding tensor elements align by rows? Like the following:
array = (a1, b1, c1
a2, b2, c2

an, bn, cn)
Possible? New to this and learning.

3 Likes

Hi,

You should use torch.cat to make them into a single tensor: giving nx2 and nx1 will give a nx3 output when concatenating along the 1st dimension.

2 Likes