-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[lang] Support vector and matrix dtypes in ti.field #7761
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for docsite-preview ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
bobcao3
approved these changes
Apr 8, 2023
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.
LGTM! I suspect all of this will be internalized into type system, once we get that done
ailzhang
added a commit
to ailzhang/taichi
that referenced
this pull request
Apr 12, 2023
Issue: taichi-dev#6572 For backward compatibility reason we cannot change any positional arg and kwargs in `ti.field` but we this PR simply added support for vector and matrix dtypes. Whether to deprecate `ti.Vector.field` and `ti.Matrix.field` can be a separate decision. Testing: to avoid massive duplicated tests I just replaced all `ti.Vector.field/ti.Matrix.field` in `test_fields.py` to use this unified API. There're plenty of other files that use the old APIs so this should be fine for now. ### Brief Summary <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at 326d67e</samp> Unified the creation of vector and matrix fields with a single `field` function in `taichi.lang.impl`. Updated the tests in `test_field.py` to use the new function and removed the deprecated ones. This improves the consistency and readability of the field API. ### Walkthrough <!-- copilot:walkthrough --> ### <samp>🤖 Generated by Copilot at 326d67e</samp> * Rename and redefine `field` function to handle vector and matrix types ([link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577L19-R19),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577L698-R704),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577R760-R805)) * Update `field` function docstring and examples in `python/taichi/lang/impl.py` ([link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577R760-R805)) * Replace `Vector.field` and `Matrix.field` with `field` function in `tests/python/test_field.py` ([link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L38-R39),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L55-R57),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L135-R137),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L141-R144),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L171-R174),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L177-R181),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L197-R203),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L207-R212),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L215-R221),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L295-R300),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L302-R308))
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this pull request
May 13, 2023
Issue: taichi-dev#6572 For backward compatibility reason we cannot change any positional arg and kwargs in `ti.field` but we this PR simply added support for vector and matrix dtypes. Whether to deprecate `ti.Vector.field` and `ti.Matrix.field` can be a separate decision. Testing: to avoid massive duplicated tests I just replaced all `ti.Vector.field/ti.Matrix.field` in `test_fields.py` to use this unified API. There're plenty of other files that use the old APIs so this should be fine for now. ### Brief Summary <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at 326d67e</samp> Unified the creation of vector and matrix fields with a single `field` function in `taichi.lang.impl`. Updated the tests in `test_field.py` to use the new function and removed the deprecated ones. This improves the consistency and readability of the field API. ### Walkthrough <!-- copilot:walkthrough --> ### <samp>🤖 Generated by Copilot at 326d67e</samp> * Rename and redefine `field` function to handle vector and matrix types ([link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577L19-R19),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577L698-R704),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577R760-R805)) * Update `field` function docstring and examples in `python/taichi/lang/impl.py` ([link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-99744c5ae5f6a754d6f68408fdc64fb0d6097216518a7f3d1ef43ffe12599577R760-R805)) * Replace `Vector.field` and `Matrix.field` with `field` function in `tests/python/test_field.py` ([link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L38-R39),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L55-R57),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L135-R137),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L141-R144),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L171-R174),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L177-R181),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L197-R203),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L207-R212),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L215-R221),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L295-R300),[link](https://github.com/taichi-dev/taichi/pull/7761/files?diff=unified&w=0#diff-c08dd53cc282976d42e5643ea69e8e30e390e2ebd2f4e73f2789f84ac56f2494L302-R308))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #6572
For backward compatibility reason we cannot change any positional arg and kwargs in
ti.field
but we this PR simply added support for vector and matrix dtypes.Whether to deprecate
ti.Vector.field
andti.Matrix.field
can be a separate decision.Testing: to avoid massive duplicated tests I just replaced all
ti.Vector.field/ti.Matrix.field
intest_fields.py
to use this unified API. There're plenty of other files that use the old APIs so this should be fine for now.Brief Summary
🤖 Generated by Copilot at 326d67e
Unified the creation of vector and matrix fields with a single
field
function intaichi.lang.impl
. Updated the tests intest_field.py
to use the new function and removed the deprecated ones. This improves the consistency and readability of the field API.Walkthrough
🤖 Generated by Copilot at 326d67e
field
function to handle vector and matrix types (link,link,link)field
function docstring and examples inpython/taichi/lang/impl.py
(link)Vector.field
andMatrix.field
withfield
function intests/python/test_field.py
(link,link,link,link,link,link,link,link,link,link,link)