tensorflow / tensorflow/graphics

Cartesian_to_spherical_coordinates returns NaN gradients near (0, 0, 1).

Open
#394 0 comments 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

Hello tensorflow-graphics team,

Could you please update the docstring to mention that NaNs gradients can be returned?
You could also consider printing a warning when the input is close to (0, 0, 1) or returning a gradient other than NaNs (e.g. 1 or 0). Alternatively, branching based on (z/radius) to use arcsin rather than arccos can also minimize numerical instabilities in the gradient, though it may also reduce performance. See [2] for an example.

The docstring mentions that this function is not smooth at (0, 0, 1) but does not specify that NaN gradients can occur. Furthermore, the website [1] is not updated to mention the smoothness and has a dead github link (Related to #383?).

[1] https://www.tensorflow.org/graphics/api_docs/python/tfg/math/math_helpers/cartesian_to_spherical_coordinates
[2] https://colab.research.google.com/drive/1ECn4eYaeQfRfXaC46BX75ZDZmwSkMkWH?usp=sharing

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 with the Cartesian_to_spherical_coordinates entry point and its current docstring, then compare the generated TensorFlow API page linked in the issue. Confirm how the existing text describes smoothness and update the relevant documentation to cover possible NaN gradients and the reported dead link; done means the local and website documentation accurately reflects the function’s behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.