Kana-alt
(Kana Alt)
#1
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

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

```
import kornia
import torch
opts=8
dis_norm=torch.rand([opts, 20, 642, 3])
a1=torch.zeros(160,1)
a2=torch.zeros(160,1)
a3=torch.zeros(160,1)
b=torch.ones(160,1)
ctl=torch.cat((a1,a2,a3,b),1).reshape(160,4)
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?