RuntimeError: There were no tensor arguments to this function (e.g., you passed an empty list of Ten

问题:

RuntimeError: There were no tensor arguments to this function (e.g., you passed an empty list of Tensors), but no fallback function i [CUDATensorId, CPUTensorId, VariableTensorId]

出问题处的函数栈如下图。

RuntimeError: There were no tensor arguments to this function (e.g., you passed an empty list of Ten_第1张图片

从函数栈中可以看出最后一个函数是torch.cat([...]),所以问题出现在这个函数中。此外这个函数也是我们自己使用,而不是库内部函数,因此我们可以检查一下这个函数的用法、函数参数是否正确。经查,在使用中函数参数results不是一个tensor列表,然后再结合Error提示,you passed an empty list of Tensors,所以确定问题是函数的使用。如图,也就是results有问题。然后将results进行修改即可,改成[tensor1, tensor2, tensor3, ...]形状的列表。

你可能感兴趣的:(pytorch)