Calculating the gradient of a sparse Tensor argument to mm is not supported

In my forward pass, I am doing element-wise multiplication of sparse and dense matrix. I am not using “*” for element-wise multiplication. I have defined another function for sparse dense matrices element-wise multiplication. I am getting this error while doing backpropagation. Can someone please help me.

thanks in advance

raceback (most recent call last):
File “train.py”, line 107, in
train(epoch)
File “train.py”, line 75, in train
loss_train.backward()
File “/home/rathee/anaconda3/envs/myenv/lib/python3.8/site-packages/torch/tensor.py”, line 195, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File “/home/rathee/anaconda3/envs/myenv/lib/python3.8/site-packages/torch/autograd/init.py”, line 97, in backward
Variable._execution_engine.run_backward(
RuntimeError: calculating the gradient of a sparse Tensor argument to mm is not supported.

1 Like