Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 张量到张量的列表_Python_Python 3.x_List_Deep Learning_Pytorch - Fatal编程技术网

Python 张量到张量的列表

Python 张量到张量的列表,python,python-3.x,list,deep-learning,pytorch,Python,Python 3.x,List,Deep Learning,Pytorch,我有一张这样的清单 xs = [tensor1, tensor2, tensor3....] 我想把它变成张量,这样我就可以把xs和ys输入到Pytorch数据加载器中。 我试过这个 xs = torch.Tensor(xs) 但它不起作用,因为单个元素不是项而是张量。您可能需要 xs=torch.stack(xs) 张量是否具有相同的维度(如果任务是NLP或时间序列相关的,则不一定给出)?@Denninger是的,维度是相同的。张量是一个图像。

我有一张这样的清单

xs = [tensor1, tensor2, tensor3....]
我想把它变成张量,这样我就可以把xs和ys输入到Pytorch数据加载器中。 我试过这个

xs = torch.Tensor(xs)
但它不起作用,因为单个元素不是项而是张量。

您可能需要

xs=torch.stack(xs)

张量是否具有相同的维度(如果任务是NLP或时间序列相关的,则不一定给出)?@Denninger是的,维度是相同的。张量是一个图像。