How to use the kornia.quaternion_to_rotation_matrix 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):
        @torch.jit.script
        def op_script(input):
            return kornia.quaternion_to_rotation_matrix(input)

        quaternion = torch.tensor([0., 0., 1., 0.]).to(device)
        actual = op_script(quaternion)
        expected = kornia.quaternion_to_rotation_matrix(quaternion)
        assert_allclose(actual, expected)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_jit(self, device):
        @torch.jit.script
        def op_script(input):
            return kornia.quaternion_to_rotation_matrix(input)

        quaternion = torch.tensor([0., 0., 1., 0.]).to(device)
        actual = op_script(quaternion)
        expected = kornia.quaternion_to_rotation_matrix(quaternion)
        assert_allclose(actual, expected)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_unit_quaternion(self, device):
        quaternion = torch.tensor([0., 0., 0., 1.]).to(device)
        expected = torch.tensor([
            [1., 0., 0.],
            [0., 1., 0.],
            [0., 0., 1.],
        ]).to(device)
        matrix = kornia.quaternion_to_rotation_matrix(quaternion)
        assert_allclose(matrix, expected)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_gradcheck(self, device):
        quaternion = torch.tensor([0., 0., 0., 1.]).to(device)
        quaternion = tensor_to_gradcheck_var(quaternion)
        # evaluate function gradient
        assert gradcheck(kornia.quaternion_to_rotation_matrix, (quaternion,),
                         raise_exception=True)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_y_rotation(self, device):
        quaternion = torch.tensor([0., 1., 0., 0.]).to(device)
        expected = torch.tensor([
            [-1., 0., 0.],
            [0., 1., 0.],
            [0., 0., -1.],
        ]).to(device)
        matrix = kornia.quaternion_to_rotation_matrix(quaternion)
        assert_allclose(matrix, expected)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_x_rotation(self, device):
        quaternion = torch.tensor([1., 0., 0., 0.]).to(device)
        expected = torch.tensor([
            [1., 0., 0.],
            [0., -1., 0.],
            [0., 0., -1.],
        ]).to(device)
        matrix = kornia.quaternion_to_rotation_matrix(quaternion)
        assert_allclose(matrix, expected)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
        @torch.jit.script
        def op_script(input):
            return kornia.quaternion_to_rotation_matrix(input)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def op_script(input):
            return kornia.quaternion_to_rotation_matrix(input)
github kornia / kornia / test / geometry / test_conversions.py View on Github external
def test_z_rotation(self, device):
        quaternion = torch.tensor([0., 0., 1., 0.]).to(device)
        expected = torch.tensor([
            [-1., 0., 0.],
            [0., -1., 0.],
            [0., 0., 1.],
        ]).to(device)
        matrix = kornia.quaternion_to_rotation_matrix(quaternion)
        assert_allclose(matrix, expected)