Skip to content

[BUG FIX] dim error in pos_lookat_up_to_T() #1444

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Kashu7100
Copy link
Collaborator

Description

Related Issue

Resolves Genesis-Embodied-AI/Genesis#

Motivation and Context

There was dim bug in geom.py

File "/home/kashu/research/Genesis/genesis/vis/camera.py", line 457, in set_pose
    self._transform = gu.pos_lookat_up_to_T(self._pos, self._lookat, self._up)
  File "/home/kashu/research/Genesis/genesis/utils/geom.py", line 1190, in pos_lookat_up_to_T
    z_up_to_R(z, up=up, out=T[:3, :3])
  File "/home/kashu/miniconda3/envs/genesis/lib/python3.10/site-packages/numba/core/dispatcher.py", line 424, in _compile_for_args
    error_rewrite(e, 'typing')
  File "/home/kashu/miniconda3/envs/genesis/lib/python3.10/site-packages/numba/core/dispatcher.py", line 365, in error_rewrite
    raise e.with_traceback(None)
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Cannot unify array(float32, 3d, C) and array(float32, 2d, A) for 'out_.2', defined at /home/kashu/research/Genesis/genesis/utils/geom.py (1148)

File "../../../Genesis/genesis/utils/geom.py", line 1148:
def z_up_to_R(z, up=None, out=None):
    <source elided>

    z_norm = np.sqrt(np.sum(np.square(z.reshape((-1, 3))), -1)).reshape(B)
    ^

During: typing of assignment at /home/kashu/research/Genesis/genesis/utils/geom.py (1148)

File "../../../Genesis/genesis/utils/geom.py", line 1148:
def z_up_to_R(z, up=None, out=None):
    <source elided>

    z_norm = np.sqrt(np.sum(np.square(z.reshape((-1, 3))), -1)).reshape(B)
    ^

During: Pass nopython_type_inference

[Genesis] [14:22:00] [ERROR] TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Cannot unify array(float32, 3d, C) and array(float32, 2d, A) for 'out_.2', defined at /home/kashu/research/Genesis/genesis/utils/geom.py (1148)

File "../../../Genesis/genesis/utils/geom.py", line 1148:
def z_up_to_R(z, up=None, out=None):
    <source elided>

    z_norm = np.sqrt(np.sum(np.square(z.reshape((-1, 3))), -1)).reshape(B)
    ^

During: typing of assignment at /home/kashu/research/Genesis/genesis/utils/geom.py (1148)

File "../../../Genesis/genesis/utils/geom.py", line 1148:
def z_up_to_R(z, up=None, out=None):
    <source elided>

    z_norm = np.sqrt(np.sum(np.square(z.reshape((-1, 3))), -1)).reshape(B)
    ^

During: Pass nopython_type_inference

How Has This Been / Can This Be Tested?

Screenshots (if appropriate):

Checklist:

  • I read the CONTRIBUTING document.
  • I followed the Submitting Code Changes section of CONTRIBUTING document.
  • I tagged the title correctly (including BUG FIX/FEATURE/MISC/BREAKING)
  • I updated the documentation accordingly or no change is needed.
  • I tested my changes and added instructions on how to test it for reviewers.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@@ -1187,6 +1186,8 @@ def pos_lookat_up_to_T(pos, lookat, up, *, dtype=np.float32):
z_norm = np.linalg.norm(z)
if z_norm < gs.EPS:
z = np.array([0.0, 1.0, 0.0], dtype=dtype)
if z.ndim == 2:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what scenarios whould z have ndim == 2? Why would lookup and pos have ndim == 2?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I don't like this "fix". We should be careful to make sure it does not break anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants