How to use the kornia.quaternion_exp_to_log 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_exp_to_log
        op_script = torch.jit.script(op)

        quaternion = torch.tensor([0., 0., 1., 0.]).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_jit(self, device):
        op = kornia.quaternion_exp_to_log
        op_script = torch.jit.script(op)

        quaternion = torch.tensor([0., 0., 1., 0.]).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_pi_quaternion(self, device):
        quaternion_exp = torch.tensor([1., 0., 0., 0.]).to(device)
        expected = torch.tensor([kornia.pi / 2, 0., 0.]).to(device)
        assert_allclose(kornia.quaternion_exp_to_log(quaternion_exp), expected)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_unit_quaternion(self, device):
        quaternion_exp = torch.tensor([0., 0., 0., 1.]).to(device)
        expected = torch.tensor([0., 0., 0.]).to(device)
        assert_allclose(kornia.quaternion_exp_to_log(quaternion_exp), expected)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_pi_quaternion(self, device):
        quaternion_exp = torch.tensor([1., 0., 0., 0.]).to(device)
        expected = torch.tensor([kornia.pi / 2, 0., 0.]).to(device)
        assert_allclose(kornia.quaternion_exp_to_log(quaternion_exp), 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_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_gradcheck(self, device):
        quaternion = torch.tensor([1., 0., 0., 0.]).to(device)
        quaternion = tensor_to_gradcheck_var(quaternion)
        # evaluate function gradient
        assert gradcheck(kornia.quaternion_exp_to_log, (quaternion,),
                         raise_exception=True)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_unit_quaternion(self, device):
        quaternion_exp = torch.tensor([0., 0., 0., 1.]).to(device)
        expected = torch.tensor([0., 0., 0.]).to(device)
        assert_allclose(kornia.quaternion_exp_to_log(quaternion_exp), expected)