Skip to content
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] Remove deprecated funcs in __init__.py #7941

Merged
merged 12 commits into from
May 9, 2023

Conversation

lin-hitonami
Copy link
Contributor

@lin-hitonami lin-hitonami commented May 6, 2023

Issue: #

πŸ€– Generated by Copilot at 1f974a4

Summary

πŸ”„πŸ—‘οΈπŸ†•

This pull request removes or updates the usage of several deprecated APIs in Taichi, such as ti.any_arr, ti.block_dim, ti.clear_all_gradients, and ti.TetMesh. The goal is to simplify the code, improve the user experience, and prepare for the upcoming release of Taichi v1.6.0. The changes affect various files in python/taichi, tests/python, and tests/cpp/aot/python_scripts.

Oh we're the brave Taichi crew, and we've got some work to do
We're clearing out the old code, and bringing in the new
So heave away, me lads and lasses, heave away with me
We'll use ti.ad and ti.loop_config, and sail the Python sea

Walkthrough

  • Remove unused and deprecated imports, names, and statements in python/taichi/__init__.py (link, link, link)
  • Replace ti.clear_all_gradients with ti.ad.clear_all_gradients in examples and tests to use the new name for the function that clears all gradients in the autodiff system (link, link, link, link, link)
  • Replace ti.any_arr with ti.types.ndarray in argument annotations of kernels in tests/cpp/aot/python_scripts to use the new name for the type that represents a Taichi ndarray (link, link, link, link, link, link, link, link, link, link, link, link)
  • Replace ti.block_dim with ti.loop_config(block_dim=...) in kernels in tests/python to use the new API for configuring loop parallelization and block dimension (link, link, link, link, link, link, link)
  • Replace ti.TetMesh with ti.lang.mesh._TetMesh in tests/python/test_mesh.py to use the new name for the class that represents a tetrahedral mesh (link, link, link, link, link, link, link, link, link)
  • Remove the test case for ti.SOA in tests/python/test_deprecation.py to match the removal of the deprecated name in python/taichi/__init__.py (link)

@netlify
Copy link

netlify bot commented May 6, 2023

βœ… Deploy Preview for docsite-preview ready!

Name Link
πŸ”¨ Latest commit 1f974a4
πŸ” Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/6458d0a3b03cfe0008da8c8b
😎 Deploy Preview https://deploy-preview-7941--docsite-preview.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@lin-hitonami lin-hitonami added this to the v1.6.0 milestone May 9, 2023
Copy link
Contributor

@feisuzhu feisuzhu left a comment

Choose a reason for hiding this comment

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

LGTM!

@lin-hitonami lin-hitonami merged commit 45b5d97 into taichi-dev:master May 9, 2023
@lin-hitonami lin-hitonami deleted the remove-init branch May 9, 2023 09:03
feisuzhu pushed a commit that referenced this pull request May 10, 2023
Issue: #
<!--
copilot:all
-->
### <samp>πŸ€– Generated by Copilot at 1f974a4</samp>

### Summary
πŸ”„πŸ—‘οΈπŸ†•

<!--
1. πŸ”„ - This emoji represents a change that renames or replaces an
existing API with a new one, such as the first two changes in the list.
It implies that the change is part of a refactoring or an update to the
codebase.
2. πŸ—‘οΈ - This emoji represents a change that removes or deletes unused or
deprecated code, such as the third and fourth changes in the list. It
implies that the change is part of a cleanup or a simplification of the
codebase.
3. πŸ†• - This emoji represents a change that adds or introduces new
features or functionality, such as the last five changes in the list. It
implies that the change is part of a enhancement or a improvement of the
codebase.
-->
This pull request removes or updates the usage of several deprecated
APIs in Taichi, such as `ti.any_arr`, `ti.block_dim`,
`ti.clear_all_gradients`, and `ti.TetMesh`. The goal is to simplify the
code, improve the user experience, and prepare for the upcoming release
of Taichi v1.6.0. The changes affect various files in `python/taichi`,
`tests/python`, and `tests/cpp/aot/python_scripts`.

> _Oh we're the brave Taichi crew, and we've got some work to do_
> _We're clearing out the old code, and bringing in the new_
> _So heave away, me lads and lasses, heave away with me_
> _We'll use `ti.ad` and `ti.loop_config`, and sail the Python sea_

### Walkthrough
* Remove unused and deprecated imports, names, and statements in
`python/taichi/__init__.py`
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-e0e39c57bc92c0e1da4c831f8820a4082a3cc26a9b88962bee72964dfa26a74aL1-L2),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-e0e39c57bc92c0e1da4c831f8820a4082a3cc26a9b88962bee72964dfa26a74aL21-R22),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-e0e39c57bc92c0e1da4c831f8820a4082a3cc26a9b88962bee72964dfa26a74aL101))
* Replace `ti.clear_all_gradients` with `ti.ad.clear_all_gradients` in
examples and tests to use the new name for the function that clears all
gradients in the autodiff system
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-12fc3a7ebde836d97c869694e52b5a407b49988c10e240c8fad33126013012acL63-R63),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-ee690f3a522eafc173aab6fe21fb1c6c4d96eaa8cd6f5aecd441079412e29635L28-R28),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-ee690f3a522eafc173aab6fe21fb1c6c4d96eaa8cd6f5aecd441079412e29635L38-R38),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-bf4b076e3a4f80273a1a730e55a004dcfcea49e3f22378c12636a35c0b707f1eL48-R48),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-bf4b076e3a4f80273a1a730e55a004dcfcea49e3f22378c12636a35c0b707f1eL93-R93))
* Replace `ti.any_arr` with `ti.types.ndarray` in argument annotations
of kernels in `tests/cpp/aot/python_scripts` to use the new name for the
type that represents a Taichi ndarray
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-4f9548204019161643336c9ebb271a758919885419bd440be93ea851fb62973aL30-R30),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-4f9548204019161643336c9ebb271a758919885419bd440be93ea851fb62973aL37-R42),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-4f9548204019161643336c9ebb271a758919885419bd440be93ea851fb62973aL62-R62),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-4f9548204019161643336c9ebb271a758919885419bd440be93ea851fb62973aL79-R84),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-4f9548204019161643336c9ebb271a758919885419bd440be93ea851fb62973aL108-R108),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL70-R72),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL87-R90),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL99-R99),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL110-R115),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL142-R142),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL149-R151),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL167-R169))
* Replace `ti.block_dim` with `ti.loop_config(block_dim=...)` in kernels
in `tests/python` to use the new API for configuring loop
parallelization and block dimension
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L57-R57),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L170-R170),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L187-R187),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L205-R205),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L219-R219),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L242-R242),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-938cc2e845889f8797de5f5de2d2a6f35fc43679c3c41d8bbbae46810c4ae518L174-R174))
* Replace `ti.TetMesh` with `ti.lang.mesh._TetMesh` in
`tests/python/test_mesh.py` to use the new name for the class that
represents a tetrahedral mesh
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L14-R14),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L30-R30),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L109-R109),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L144-R144),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L166-R166),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L187-R187),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L222-R222),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L258-R258),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L277-R277))
* Remove the test case for `ti.SOA` in
`tests/python/test_deprecation.py` to match the removal of the
deprecated name in `python/taichi/__init__.py`
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-8981be068a363e39524dc2e29d28d4c13a097d0037fc3a1176b249ce5bf35ef8L80-L88))
quadpixels pushed a commit to quadpixels/taichi that referenced this pull request May 13, 2023
Issue: #
<!--
copilot:all
-->
### <samp>πŸ€– Generated by Copilot at 1f974a4</samp>

### Summary
πŸ”„πŸ—‘οΈπŸ†•

<!--
1. πŸ”„ - This emoji represents a change that renames or replaces an
existing API with a new one, such as the first two changes in the list.
It implies that the change is part of a refactoring or an update to the
codebase.
2. πŸ—‘οΈ - This emoji represents a change that removes or deletes unused or
deprecated code, such as the third and fourth changes in the list. It
implies that the change is part of a cleanup or a simplification of the
codebase.
3. πŸ†• - This emoji represents a change that adds or introduces new
features or functionality, such as the last five changes in the list. It
implies that the change is part of a enhancement or a improvement of the
codebase.
-->
This pull request removes or updates the usage of several deprecated
APIs in Taichi, such as `ti.any_arr`, `ti.block_dim`,
`ti.clear_all_gradients`, and `ti.TetMesh`. The goal is to simplify the
code, improve the user experience, and prepare for the upcoming release
of Taichi v1.6.0. The changes affect various files in `python/taichi`,
`tests/python`, and `tests/cpp/aot/python_scripts`.

> _Oh we're the brave Taichi crew, and we've got some work to do_
> _We're clearing out the old code, and bringing in the new_
> _So heave away, me lads and lasses, heave away with me_
> _We'll use `ti.ad` and `ti.loop_config`, and sail the Python sea_

### Walkthrough
* Remove unused and deprecated imports, names, and statements in
`python/taichi/__init__.py`
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-e0e39c57bc92c0e1da4c831f8820a4082a3cc26a9b88962bee72964dfa26a74aL1-L2),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-e0e39c57bc92c0e1da4c831f8820a4082a3cc26a9b88962bee72964dfa26a74aL21-R22),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-e0e39c57bc92c0e1da4c831f8820a4082a3cc26a9b88962bee72964dfa26a74aL101))
* Replace `ti.clear_all_gradients` with `ti.ad.clear_all_gradients` in
examples and tests to use the new name for the function that clears all
gradients in the autodiff system
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-12fc3a7ebde836d97c869694e52b5a407b49988c10e240c8fad33126013012acL63-R63),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-ee690f3a522eafc173aab6fe21fb1c6c4d96eaa8cd6f5aecd441079412e29635L28-R28),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-ee690f3a522eafc173aab6fe21fb1c6c4d96eaa8cd6f5aecd441079412e29635L38-R38),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-bf4b076e3a4f80273a1a730e55a004dcfcea49e3f22378c12636a35c0b707f1eL48-R48),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-bf4b076e3a4f80273a1a730e55a004dcfcea49e3f22378c12636a35c0b707f1eL93-R93))
* Replace `ti.any_arr` with `ti.types.ndarray` in argument annotations
of kernels in `tests/cpp/aot/python_scripts` to use the new name for the
type that represents a Taichi ndarray
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-4f9548204019161643336c9ebb271a758919885419bd440be93ea851fb62973aL30-R30),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-4f9548204019161643336c9ebb271a758919885419bd440be93ea851fb62973aL37-R42),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-4f9548204019161643336c9ebb271a758919885419bd440be93ea851fb62973aL62-R62),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-4f9548204019161643336c9ebb271a758919885419bd440be93ea851fb62973aL79-R84),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-4f9548204019161643336c9ebb271a758919885419bd440be93ea851fb62973aL108-R108),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL70-R72),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL87-R90),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL99-R99),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL110-R115),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL142-R142),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL149-R151),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-b2b340803f06d4337ecaf4f14abf66755d888946b08939b1f1e88e64d293b40aL167-R169))
* Replace `ti.block_dim` with `ti.loop_config(block_dim=...)` in kernels
in `tests/python` to use the new API for configuring loop
parallelization and block dimension
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L57-R57),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L170-R170),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L187-R187),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L205-R205),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L219-R219),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-2ea5f113062438816406fbdb85d44d0b44fde412eed818ea1c06c9584c887277L242-R242),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-938cc2e845889f8797de5f5de2d2a6f35fc43679c3c41d8bbbae46810c4ae518L174-R174))
* Replace `ti.TetMesh` with `ti.lang.mesh._TetMesh` in
`tests/python/test_mesh.py` to use the new name for the class that
represents a tetrahedral mesh
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L14-R14),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L30-R30),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L109-R109),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L144-R144),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L166-R166),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L187-R187),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L222-R222),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L258-R258),
[link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-a5d38fced7102d9278d61f209491478ba617cfc016e6dc37840da62cfef36f09L277-R277))
* Remove the test case for `ti.SOA` in
`tests/python/test_deprecation.py` to match the removal of the
deprecated name in `python/taichi/__init__.py`
([link](https://github.com/taichi-dev/taichi/pull/7941/files?diff=unified&w=0#diff-8981be068a363e39524dc2e29d28d4c13a097d0037fc3a1176b249ce5bf35ef8L80-L88))
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