-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [bug] Fix incorrect autodiff_mode information in offline cache key (#5737) * [bug] Fix incorrect autodiff_mode infomation in offline cache key * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * [Error] Do not show warning when the offline cache path does not exist (#5747) * [Error] Do not show warning when the offline cache path does not exist * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * [Bug] [type] Fix wrong type cast in codegen of storing quant floats (#5818) * [autodiff] Support shift ptr in dynamic index (#5770) * [autodiff] Support shift ptr in dynamic index * update the offset * update offset * add dynamic index test for ad * forcely enable dynamic index for polar decompose Co-authored-by: Mingming Zhang <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Lin Jiang <[email protected]> Co-authored-by: Yi Xu <[email protected]> Co-authored-by: Mingrui Zhang <[email protected]>
- Loading branch information
1 parent
f5bb646
commit aae46db
Showing
8 changed files
with
151 additions
and
24 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import taichi as ti | ||
from tests import test_utils | ||
|
||
|
||
@test_utils.test(require=ti.extension.dynamic_index, | ||
dynamic_index=True, | ||
debug=True) | ||
def test_matrix_non_constant_index(): | ||
m = ti.Matrix.field(2, 2, ti.f32, 5, needs_grad=True) | ||
n = ti.Matrix.field(2, 2, ti.f32, 5, needs_grad=True) | ||
loss = ti.field(ti.f32, (), needs_grad=True) | ||
|
||
n.fill(0) | ||
|
||
@ti.kernel | ||
def func1(): | ||
for i in range(5): | ||
for j, k in ti.ndrange(2, 2): | ||
m[i][j, k] = (j + 1) * (k + 1) * n[i][j, k] | ||
loss[None] += m[i][j, k] | ||
|
||
loss.grad[None] = 1.0 | ||
func1.grad() | ||
|
||
for i in range(5): | ||
for j in range(2): | ||
for k in range(2): | ||
assert n.grad[i][j, k] == (j + 1) * (k + 1) |
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
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