Skip to content

Conversation

bluevisor
Copy link

Issue: #
This PR addresses a Taichi warning in comet.py by explicitly casting i to an integer in the ti.deactivate function. The warning appeared as follows:
TaichiWarning While compiling substep_c76_0, File “taichi/examples/simulation/comet.py”, line 55, in substep: ti.deactivate(x.snode.parent(), [i]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Field index 0 not int32, casting into int32 implicitly

Changes Made

  • Updated ti.deactivate(x.snode.parent(), [i]) to ti.deactivate(x.snode.parent(), [int(i)]) in comet.py.

Rationale

Explicitly casting i to int prevents Taichi from implicitly casting and suppresses the TaichiWarning. This change improves code clarity and ensures compatibility with the expected data type for the function.

Testing

  • Confirmed that the warning is no longer displayed when running comet.py.
  • Functionality of comet.py remains intact after this change.

Explicitly cast index `i` to int in `ti.deactivate` to prevent TaichiWarning
@CLAassistant
Copy link

CLAassistant commented Nov 10, 2024

CLA assistant check
All committers have signed the CLA.

@bluevisor bluevisor changed the title Fix TaichiWarning by casting index to int in comet.py fix: cast index to int in comet.py to resolve TaichiWarning Nov 10, 2024
@bluevisor bluevisor changed the title fix: cast index to int in comet.py to resolve TaichiWarning [Fix] Cast index to int in comet.py to resolve TaichiWarning Nov 10, 2024
@bluevisor bluevisor changed the title [Fix] Cast index to int in comet.py to resolve TaichiWarning [misc] Cast index to int in comet.py to resolve TaichiWarning Nov 10, 2024
@bluevisor bluevisor changed the title [misc] Cast index to int in comet.py to resolve TaichiWarning [Example] Cast index to int in comet.py to resolve TaichiWarning Nov 10, 2024
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.

2 participants