How to use the kornia.quaternion_log_to_exp function in kornia

To help you get started, we’ve selected a few kornia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kornia / kornia / test / geometry / test_conversions.py View on Github external
    @pytest.mark.skip(reason="turn off all jit for a while")
    def test_jit(self, device):
        op = kornia.quaternion_log_to_exp
        op_script = torch.jit.script(op)

        quaternion = torch.tensor([0., 0., 1.]).to(device)
        actual = op_script(quaternion)
        expected = op(quaternion)
        assert_allclose(actual, expected)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_back_and_forth(self, device):
        quaternion_exp = torch.tensor([1., 0., 0., 0.]).to(device)
        quaternion_log = kornia.quaternion_exp_to_log(quaternion_exp)
        quaternion_exp_hat = kornia.quaternion_log_to_exp(quaternion_log)
        assert_allclose(quaternion_exp, quaternion_exp_hat)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_unit_quaternion(self, device):
        quaternion_log = torch.tensor([0., 0., 0.]).to(device)
        expected = torch.tensor([0., 0., 0., 1.]).to(device)
        assert_allclose(kornia.quaternion_log_to_exp(quaternion_log), expected)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_pi_quaternion(self, device):
        one = torch.tensor(1.).to(device)
        quaternion_log = torch.tensor([1., 0., 0.]).to(device)
        expected = torch.tensor([torch.sin(one), 0., 0., torch.cos(one)]).to(device)
        assert_allclose(kornia.quaternion_log_to_exp(quaternion_log), expected)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
    @pytest.mark.parametrize("batch_size", (1, 3, 8))
    def test_smoke_batch(self, device, batch_size):
        quaternion_log = torch.zeros(batch_size, 3).to(device)
        quaternion_exp = kornia.quaternion_log_to_exp(quaternion_log)
        assert quaternion_exp.shape == (batch_size, 4)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_back_and_forth(self, device):
        quaternion_log = torch.tensor([0., 0., 0.]).to(device)
        quaternion_exp = kornia.quaternion_log_to_exp(quaternion_log)
        quaternion_log_hat = kornia.quaternion_exp_to_log(quaternion_exp)
        assert_allclose(quaternion_log, quaternion_log_hat)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_gradcheck(self, device):
        quaternion = torch.tensor([0., 0., 1.]).to(device)
        quaternion = tensor_to_gradcheck_var(quaternion)
        # evaluate function gradient
        assert gradcheck(kornia.quaternion_log_to_exp, (quaternion,),
                         raise_exception=True)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_gradcheck(self, device):
        quaternion = torch.tensor([0., 0., 1.]).to(device)
        quaternion = tensor_to_gradcheck_var(quaternion)
        # evaluate function gradient
        assert gradcheck(kornia.quaternion_log_to_exp, (quaternion,),
                         raise_exception=True)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_smoke_batch(self, device, batch_size):
        quaternion_log = torch.zeros(batch_size, 3).to(device)
        quaternion_exp = kornia.quaternion_log_to_exp(quaternion_log)
        assert quaternion_exp.shape == (batch_size, 4)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_back_and_forth(self, device):
        quaternion_log = torch.tensor([0., 0., 0.]).to(device)
        quaternion_exp = kornia.quaternion_log_to_exp(quaternion_log)
        quaternion_log_hat = kornia.quaternion_exp_to_log(quaternion_exp)
        assert_allclose(quaternion_log, quaternion_log_hat)