Torch.matmul does not work properly

I calculated the rank4xrank4 matrix using torch.mamtmul.
As a result, all the values became zero.

Can you tell me the cause of this?

The code is below. In the second line of the calculation, the values are all set to zero.

dis_norm = (self.ctl_ts.view(opts.n_hypo,-1,1,3) - pred_v.view(2*local_batch_size,opts.n_hypo,-1,3)[0,:,None].detach()) # p-v, H,J,1,3 - H,1,N,3
dis_norm = dis_norm.matmul(kornia.quaternion_to_rotation_matrix(self.ctl_rs).view(opts.n_hypo,-1,3,3)) # h,j,n,3
dis_norm = self.log_ctl.exp().view(opts.n_hypo,-1,1,3) * dis_norm.pow(2) # (p-v)^TS(p-v)

Could you post an executable code snippet (with random inputs, assuming they recreate the issue) so that we could try to reproduce it, please?

PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier :wink:

I’m not sure I understand the sentence correctly. Are you able to reproduce the all-zero output using:

import kornia
import torch
dis_norm=torch.rand([opts, 20, 642, 3])


dis_norm = dis_norm.matmul(kornia.quaternion_to_rotation_matrix(ctl).view(opts,-1,3,3)) # h,j,n,3

If so, could you post the output of python -m torch.utils.collect_env here, please?