tensorflow / tensorflow/graphics

quaternion matmul function

Open
#694 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.8k
Forks
374
PR merge metrics
No merged PRs in 30d

Description

Would be nice to have a matmul function in the quaternion library. I'm willing to implement and emulate the existing style in the quaternion library.

Something like:


def matmul(quaternion1: type_alias.TensorLike,
             quaternion2: type_alias.TensorLike,
             name: str = "quaternion_matmul"
             ) -> tf.Tensor:
  """Multiplies matrices of quaternions.
  Note:
    In the following, A1 to An are optional batch dimensions.
  Args:
    quaternion1:  A tensor of shape `[A1, ..., An, M1, M2, 4]`, where M1 and M2 are the matrix dimensions, and the last dimension
      represents a quaternion.
    quaternion2:  A tensor of shape `[A1, ..., An, M2, M3, 4]`, where M2 and M3 are the matrix dimensions, and the last dimension
      represents a quaternion.
    name: A name for this op that defaults to "quaternion_matmul".
  Returns:
    A tensor of shape `[A1, ..., An, M1, M3, 4]` representing matrices of quaternions.
  Raises:
    ValueError: If the shape of `quaternion1` or `quaternion2` is not supported.
  """

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the linked TensorFlow Graphics quaternion library and inspect existing quaternion operations to follow its style. Implement the requested matmul API for the documented quaternion-matrix shapes, and verify that it returns the stated [A1, ..., An, M1, M3, 4] shape while handling unsupported shapes as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
computer-graphics
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.