Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Example] Cast index to int in comet.py to resolve TaichiWarning#8597

Open
bluevisor wants to merge 1 commit intotaichi-dev:mastertaichi-dev/taichi:masterfrom
bluevisor:patch-2bluevisor/taichi:patch-2Copy head branch name to clipboard
Open

[Example] Cast index to int in comet.py to resolve TaichiWarning#8597
bluevisor wants to merge 1 commit intotaichi-dev:mastertaichi-dev/taichi:masterfrom
bluevisor:patch-2bluevisor/taichi:patch-2Copy head branch name to clipboard

Conversation

@bluevisor
Copy link
Copy Markdown

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
Copy Markdown

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.