-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add functionality for cartesian from polar coords #216
base: main
Are you sure you want to change the base?
Conversation
b3a21f1
to
feafa09
Compare
def cartesian_via_polar(abs: "tripy.Tensor", angles: "tripy.Tensor") -> "tripy.Tensor": | ||
r""" | ||
Constructs the real-valued cartesian coordinates from magnitude and angle representing polar coordinates. For input | ||
``abs`` and ``angle`` of shape :math:`(m_1, m_2, \ldots, m_i),` this function returns a new real tensor of shape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``abs`` and ``angle`` of shape :math:`(m_1, m_2, \ldots, m_i),` this function returns a new real tensor of shape | |
``abs`` and ``angles`` of shape :math:`(m_1, m_2, \ldots, m_i),` this function returns a new real tensor of shape |
dtype_variables={"T1": ["float32", "float16", "bfloat16", "float8"]}, | ||
dtype_constraints={"abs": "T1", "angles": "T1", constraints.RETURN_VALUE: "T1"}, | ||
) | ||
def cartesian_via_polar(abs: "tripy.Tensor", angles: "tripy.Tensor") -> "tripy.Tensor": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this as an API in Tripy and why can't it be a user function? Can you point to similar functionality provided by torch, jax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This recreates the functionality of torch.polar and torch.view_as_real. Since we don't support complex numbers, I think it's useful to have an existing function that directly accomplishes the same purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better as a helper in the example?
No description provided.