Hi,
I’m trying to create tensor from a variable data, which is a list. According to the documentation 4 , I should be able to that using torch.Tensor() method. I have ensured that the list doesn’t contain any strings.
The list looks like this:
[tensor([[ 4.6291e-03, -1.3071e-05, -1.0033e-03,  …,  3.7078e-02,
7.7851e-03,  3.4532e-02],
[ 7.5976e-03, -1.4478e-05,  6.4205e-03,  …,  2.3013e-02,
9.6373e-03,  3.6175e-02],
[ 1.0242e-02, -2.6630e-05,  1.5521e-03,  …,  3.2181e-02,
1.6385e-02,  8.6033e-03],
…,
[ 6.9822e-03, -4.2445e-05,  5.6378e-03,  …,  1.9608e-02,
8.2644e-03,  1.8788e-02],
[ 6.9822e-03, -4.2445e-05,  5.6378e-03,  …,  1.9608e-02,
8.2644e-03,  1.8788e-02],
[ 7.3356e-03, -2.1180e-05,  4.7856e-03,  …,  1.7249e-02,
6.8688e-03,  4.0911e-02]])]
However, I am getting ValueError: only one element tensors can be converted to Python scalars. I’m unable to figure out what exactly is the error trying to say.
Please see below the code snippet.
codeSnippet.png636×520 59.8 KB

I think I might have missed something very trivial, but I’ve been stuck here for quite some time. Any direction as to why this error occurs would be greatly appreciated.
Thanks in advance