diff --git a/tests/python/frontend/onnx/test_forward.py b/tests/python/frontend/onnx/test_forward.py index 52c3346e5807..b57e019c5808 100644 --- a/tests/python/frontend/onnx/test_forward.py +++ b/tests/python/frontend/onnx/test_forward.py @@ -2253,7 +2253,7 @@ def verify_where(condition, x, y, dtype, outdata, dynamic=False): @tvm.testing.uses_gpu def test_where(): - condition = np.array([[1, 0], [1, 1]], dtype=np.bool) + condition = np.array([[1, 0], [1, 1]], dtype=bool) x = np.array([[1, 2], [3, 4]], dtype=np.int64) y = np.array([[9, 8], [7, 6]], dtype=np.int64) outdata = np.where(condition, x, y) @@ -2274,7 +2274,7 @@ def test_where(): outdata = np.where(condition, x, y) verify_where(condition, x, y, TensorProto.FLOAT, outdata) - condition = np.array(1, dtype=np.bool) + condition = np.array(1, dtype=bool) x = np.array([[1, 2], [3, 4]], dtype=np.float32) y = np.array([[5, 6], [7, 8]], dtype=np.float32) outdata = np.where(condition, x, y) @@ -3922,7 +3922,7 @@ def verify_cond_loop(): trip_count = np.array(5).astype(np.int64) res_y = np.array([13]).astype(np.float32) - cond = np.array(1).astype(np.bool) + cond = np.array(1).astype(bool) loop_graph = onnx.helper.make_graph( [loop_node], "loop_outer", @@ -3940,7 +3940,7 @@ def verify_cond_loop(): # Set a high trip count so that condition trips first. trip_count = np.array(40).astype(np.int64) - cond = np.array(1).astype(np.bool) + cond = np.array(1).astype(bool) input_vals = [trip_count, cond, y] verify_with_ort_with_inputs(loop_model, input_vals, use_vm=True, freeze_params=True) @@ -3978,7 +3978,7 @@ def verify_count_loop(): trip_count = np.array(5).astype(np.int64) res_y = np.array([13]).astype(np.float32) - cond = np.array(1).astype(np.bool) + cond = np.array(1).astype(bool) loop_graph = onnx.helper.make_graph( [loop_node], "loop_outer", @@ -3995,7 +3995,7 @@ def verify_count_loop(): loop_model = onnx.helper.make_model(loop_graph) trip_count = np.array(5).astype(np.int64) - cond = np.array(1).astype(np.bool) + cond = np.array(1).astype(bool) input_vals = [trip_count, cond, y] verify_with_ort_with_inputs(loop_model, input_vals, use_vm=True, freeze_params=True) @@ -4032,7 +4032,7 @@ def verify_tensor_loop(): ) trip_count = np.array(5).astype(np.int64) - cond = np.array(1).astype(np.bool) + cond = np.array(1).astype(bool) loop_graph = onnx.helper.make_graph( [loop_node], "loop_outer", @@ -4049,7 +4049,7 @@ def verify_tensor_loop(): loop_model = onnx.helper.make_model(loop_graph) trip_count = np.array(5).astype(np.int64) - cond = np.array(1).astype(np.bool) + cond = np.array(1).astype(bool) input_vals = [trip_count, cond, y] verify_with_ort_with_inputs( loop_model, input_vals, use_vm=True, freeze_params=True, convert_to_static=True diff --git a/tests/python/relay/test_op_level4.py b/tests/python/relay/test_op_level4.py index c4d26a1811b1..b59325aea2f9 100644 --- a/tests/python/relay/test_op_level4.py +++ b/tests/python/relay/test_op_level4.py @@ -189,7 +189,7 @@ def verify(x_np, y_np, cond_np): x_np = np.array(1.0, dtype) y_np = np.array(-1.0, dtype) - cond_np = np.array([1, 0, 1], dtype=np.bool) + cond_np = np.array([1, 0, 1], dtype=bool) verify(x_np, y_np, cond_np) @@ -201,7 +201,7 @@ def verify(x_np, y_np, cond_np): x_np = np.array([[1, 2], [3, 4]], dtype) y_np = np.array([[5, 6], [7, 8]], dtype) - cond_np = np.array([[1], [0]], dtype=np.bool) + cond_np = np.array([[1], [0]], dtype=bool) verify(x_np, y_np, cond_np) verify(x_np, y_np, cond_np.T) @@ -213,7 +213,7 @@ def verify(x_np, y_np, cond_np): verify(x_np, y_np, cond_np) x_np, y_np = np.ogrid[:3, :4] - cond_np = np.where(x_np < y_np, x_np, 10 + y_np).astype(np.bool) + cond_np = np.where(x_np < y_np, x_np, 10 + y_np).astype(bool) verify(x_np.astype(dtype), y_np.astype(dtype), cond_np) diff --git a/tests/python/topi/python/test_topi_depthwise_conv2d_back_weight.py b/tests/python/topi/python/test_topi_depthwise_conv2d_back_weight.py index 8e30ed6840e3..0bbb0e6c0cca 100644 --- a/tests/python/topi/python/test_topi_depthwise_conv2d_back_weight.py +++ b/tests/python/topi/python/test_topi_depthwise_conv2d_back_weight.py @@ -36,8 +36,8 @@ def verify_depthwise_conv2d_back_weight( stride_w = stride_h padding_w = padding_h - out_h = np.int((in_h + 2 * padding_h - filter_h) / stride_h + 1) - out_w = np.int((in_w + 2 * padding_w - filter_w) / stride_w + 1) + out_h = int((in_h + 2 * padding_h - filter_h) / stride_h + 1) + out_w = int((in_w + 2 * padding_w - filter_w) / stride_w + 1) out_channel = in_channel * channel_multiplier oshape = [batch, out_h, out_w, out_channel] diff --git a/tests/python/unittest/test_tir_nodes.py b/tests/python/unittest/test_tir_nodes.py index 89ca9ac70b92..07a82ba9936c 100644 --- a/tests/python/unittest/test_tir_nodes.py +++ b/tests/python/unittest/test_tir_nodes.py @@ -29,7 +29,7 @@ def test_const(): def test_scalar_dtype_inference(): for data in [ True, - np.bool(1), + bool(1), np.uint8(1), np.uint16(1), np.uint32(1), @@ -48,7 +48,7 @@ def test_scalar_dtype_inference(): for data in [ True, - np.bool(1), + bool(1), np.uint8(1), np.uint16(1), np.uint32(1),