[Tests] Fix rest of NumPy deprecated types (#15245)

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
This commit is contained in:
Roman Kazantsev 2023-01-21 15:17:52 +04:00 committed by GitHub
parent 7ff9f80c68
commit 0d201376df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 6 deletions

View File

@ -90,7 +90,7 @@ def test_binary_logical_op_parameter_inputs(ng_api_helper):
[ng.logical_and, ng.logical_or, ng.logical_xor],
)
def test_binary_logical_numpy_input(ng_api_helper):
value_b = np.array([[False, True], [False, True]], dtype=np.bool)
value_b = np.array([[False, True], [False, True]], dtype=bool)
shape = [2, 2]
parameter_a = ng.parameter(shape, name="A", dtype=bool)

View File

@ -12,7 +12,7 @@ def paddle_assign_value(name, test_x):
main_program = paddle.static.Program()
startup_program = paddle.static.Program()
with paddle.static.program_guard(main_program, startup_program):
node_x = paddle.static.data(name='x', shape=test_x.shape, dtype=test_x.dtype if test_x.dtype != np.bool else np.int32)
node_x = paddle.static.data(name='x', shape=test_x.shape, dtype=test_x.dtype if test_x.dtype != bool else np.int32)
node_x = paddle.cast(node_x, dtype=test_x.dtype)
const_value = paddle.assign(test_x, output=None)
result = paddle.cast(paddle.concat([node_x, const_value], 0), dtype=np.float32)
@ -20,7 +20,7 @@ def paddle_assign_value(name, test_x):
exe = paddle.static.Executor(cpu[0])
# startup program will call initializer to initialize the parameters.
exe.run(paddle.static.default_startup_program())
if test_x.dtype == np.bool:
if test_x.dtype == bool:
test_x = test_x.astype(np.int32)
outs = exe.run(

View File

@ -53,7 +53,7 @@ def mkdirp(d):
def fill_tensors_with_random(input):
dtype = get_dtype(input.get_element_type())
rand_min, rand_max = (0, 1) if dtype == np.bool else (np.iinfo(np.uint8).min, np.iinfo(np.uint8).max)
rand_min, rand_max = (0, 1) if dtype == bool else (np.iinfo(np.uint8).min, np.iinfo(np.uint8).max)
# np.random.uniform excludes high: add 1 to have it generated
if np.dtype(dtype).kind in ['i', 'u', 'b']:
rand_max += 1

View File

@ -18,7 +18,7 @@ class TestLoop(OnnxRuntimeLayerTest):
elif tensor_type == TensorProto.FLOAT:
np_type = np.float
elif tensor_type == TensorProto.BOOL:
np_type = np.bool
np_type = bool
else:
return None
return helper.make_node('Constant', inputs=[], outputs=[name],

View File

@ -83,7 +83,7 @@ class TestBinaryOps(CommonTFLayerTest):
type = np.float32
if op_type in ["LogicalAnd", "LogicalOr", "LogicalXor"]:
type = np.bool
type = bool
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess: