CalciferZh / SMPL

NumPy, TensorFlow and PyTorch implementation of human body SMPL model and infant body SMIL model.
MIT License
881 stars 138 forks source link

cuda error #42

Closed xjsxujingsong closed 4 years ago

xjsxujingsong commented 4 years ago

Hi when I run smpl_torch_batch.py It gets:

File "C:\Users\xjsxu\Anaconda3\lib\site-packages\torch\functional.py", line 755, in norm return torch._C._VariableFunctions.frobenius_norm(input, dim, keepdim=keepdim) RuntimeError: Could not run 'aten::conj.out' with arguments from the 'CUDATensorId' backend. 'aten::conj.out' is only available for these backends: [CPUTensorId, VariableTensorId].

CPU version is fine. Anaconda 3.7.3 torch: 1.4.0

xjsxujingsong commented 4 years ago

After updating pytorch to 1.5.0 and going back to 1.2.0. I completely lost what is going. Now this is the new error on both CPU and CUDA

print(result.shape) print(self.joint_regressor.shape) torch.Size([32, 6890, 3]) torch.Size([24, 6890])

File "d:\code\SMPL\smpl\CalciferZh\smpl_torch_batch.py", line 200, in forward joints = torch.tensordot(result, self.joint_regressor, dims=([1], [0])).transpose(1, 2) File "C:\Users\xjsxu\Anaconda3\lib\site-packages\torch\functional.py", line 575, in tensordot return torch._C._VariableFunctions.tensordot(a, b, dims_a, dims_b) RuntimeError: contracted dimensions need to match, but first has size 6890 in dim 1 and second has size 24 in dim 0

Finally I solved this problem by

joints = torch.tensordot(result, self.joint_regressor.transpose(1, 0), dims=([1], [0])).transpose(1, 2)

OOF-dura commented 3 years ago
joints = torch.tensordot(result, self.joint_regressor.transpose(1, 0), dims=([1], [0])).transpose(1, 2)

saved my day. Thx!