pytorch相关函数

1、torch.cumsum
torch.cumsum(input, dim, *, dtype=None, out=None) → Tensor
Returns the cumulative sum of elements of input in the dimension dim.
这里对于dim维度求和,注意的是每一个元素的值都是与之前元素的求和

KeyError: ‘1403636581013555456.png’

2、
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

不在一个设备
poses = poses.to(device=torch.device(‘cuda’ if torch.cuda.is_available() else ‘cpu’))

3、创建全零矩阵tensor

features = torch.zeros(1,6,64) #括号中为矩阵维度

4、tensor转化为numpy
tensor.detach().numpy()

你可能感兴趣的:(pytorch,pytorch,numpy,python)