Skip to content

Gradient not calculated for transforms.matrix_to_quaternion #119

@m-nez

Description

@m-nez

It looks like the gradient is not calculated for transforms.matrix_to_quaternion.

import pytorch3d.transforms
import torch

matrix = torch.eye(3, requires_grad=True)
target = torch.Tensor([0.984808, 0, 0.174, 0])

optimizer = torch.optim.Adam([matrix], lr=0.05)
optimizer.zero_grad()
q = pytorch3d.transforms.matrix_to_quaternion(
    matrix
)
loss = torch.sum((q - target)**2)
loss.backward()
optimizer.step()

print(matrix)

After running the code above the matrix after optimizer step shouldn't contain NaNs, but it does.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions