diff --git a/python/taichi/examples/simulation/implicit_fem.py b/python/taichi/examples/simulation/implicit_fem.py index acd147009c0e0..c3ac69d8b3937 100644 --- a/python/taichi/examples/simulation/implicit_fem.py +++ b/python/taichi/examples/simulation/implicit_fem.py @@ -37,8 +37,8 @@ use_sparse = args.use_sparse n_cube = np.array([5] * 3) -n_verts = np.product(n_cube) -n_cells = 5 * np.product(n_cube - 1) +n_verts = np.prod(n_cube) +n_cells = 5 * np.prod(n_cube - 1) dx = 1 / (n_cube.max() - 1) F_vertices = ti.Vector.field(4, dtype=ti.i32, shape=n_cells) diff --git a/tests/python/test_implicit_fem.py b/tests/python/test_implicit_fem.py index 160b8f2d1f1b6..dbe37843193f1 100644 --- a/tests/python/test_implicit_fem.py +++ b/tests/python/test_implicit_fem.py @@ -15,8 +15,8 @@ def test_implicit_fem(): use_sparse = 0 n_cube = np.array([5] * 3) - n_verts = np.product(n_cube) - n_cells = 5 * np.product(n_cube - 1) + n_verts = np.prod(n_cube) + n_cells = 5 * np.prod(n_cube - 1) dx = 1 / (n_cube.max() - 1) F_vertices = ti.Vector.field(4, dtype=ti.i32, shape=n_cells) diff --git a/tests/python/test_reduction.py b/tests/python/test_reduction.py index 851a6e320b2f6..921f32966e456 100644 --- a/tests/python/test_reduction.py +++ b/tests/python/test_reduction.py @@ -89,13 +89,13 @@ def reduce_tmp() -> dtype: @pytest.mark.parametrize("op", [OP_ADD, OP_MIN, OP_MAX, OP_AND, OP_OR, OP_XOR]) @test_utils.test() def test_reduction_single_i32(op): - _test_reduction_single(ti.i32, lambda x, y: x % 2**32 == y % 2**32, op) + _test_reduction_single(ti.i32, lambda x, y: int(x) % 2**32 == int(y) % 2**32, op) @pytest.mark.parametrize("op", [OP_ADD]) @test_utils.test(exclude=[ti.opengl, ti.gles]) def test_reduction_single_u32(op): - _test_reduction_single(ti.u32, lambda x, y: x % 2**32 == y % 2**32, op) + _test_reduction_single(ti.u32, lambda x, y: int(x) % 2**32 == int(y) % 2**32, op) @pytest.mark.parametrize("op", [OP_ADD, OP_MIN, OP_MAX]) @@ -107,13 +107,13 @@ def test_reduction_single_f32(op): @pytest.mark.parametrize("op", [OP_ADD]) @test_utils.test(require=ti.extension.data64) def test_reduction_single_i64(op): - _test_reduction_single(ti.i64, lambda x, y: x % 2**64 == y % 2**64, op) + _test_reduction_single(ti.i64, lambda x, y: int(x) % 2**64 == int(y) % 2**64, op) @pytest.mark.parametrize("op", [OP_ADD]) @test_utils.test(exclude=[ti.opengl, ti.gles], require=ti.extension.data64) def test_reduction_single_u64(op): - _test_reduction_single(ti.u64, lambda x, y: x % 2**64 == y % 2**64, op) + _test_reduction_single(ti.u64, lambda x, y: int(x) % 2**64 == int(y) % 2**64, op) @pytest.mark.parametrize("op", [OP_ADD])