Fixed numpy deprecation error (#20375)

This commit is contained in:
Ilya Lavrenov 2023-10-11 00:38:23 +04:00 committed by GitHub
parent c61fce428e
commit b3ead62631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@ test_params = [
'shape_shape': [1], 'shape_value': [8]},
{'indices_shape': [4, 1], 'indices_value': [4, 3, 1, 7], 'updates_dtype': np.float32, 'updates_shape': [4],
'shape_shape': [1], 'shape_value': [8]},
{'indices_shape': [4, 1], 'indices_value': [4, 3, 1, 7], 'updates_dtype': np.bool, 'updates_shape': [4],
{'indices_shape': [4, 1], 'indices_value': [4, 3, 1, 7], 'updates_dtype': bool, 'updates_shape': [4],
'shape_shape': [1], 'shape_value': [8]},
{'indices_shape': [4, 2], 'indices_value': [[0, 0], [1, 0], [0, 2], [1, 2]], 'updates_dtype': np.int32,
@ -22,7 +22,7 @@ test_params = [
'updates_shape': [4, 5], 'shape_shape': [3], 'shape_value': [2, 3, 5]},
{'indices_shape': [4, 2], 'indices_value': [[0, 0], [1, 0], [0, 2], [1, 2]], 'updates_dtype': np.float32,
'updates_shape': [4, 5], 'shape_shape': [3], 'shape_value': [2, 3, 5]},
{'indices_shape': [4, 2], 'indices_value': [[0, 0], [1, 0], [0, 2], [1, 2]], 'updates_dtype': np.bool,
{'indices_shape': [4, 2], 'indices_value': [[0, 0], [1, 0], [0, 2], [1, 2]], 'updates_dtype': bool,
'updates_shape': [4, 5], 'shape_shape': [3], 'shape_value': [2, 3, 5]},
]

View File

@ -13,7 +13,7 @@ test_params = [
'begin_mask': 8, 'end_mask': 3, 'shrink_axis_mask': 4},
{'shape': [12, 2, 2, 5], 'dtype': np.int64, 'strides': [1], 'begin': [0], 'end': [1],
'begin_mask': 8, 'end_mask': 3, 'shrink_axis_mask': None},
{'shape': [12, 2, 2, 5], 'dtype': np.bool, 'strides': [1], 'begin': [0], 'end': [1],
{'shape': [12, 2, 2, 5], 'dtype': bool, 'strides': [1], 'begin': [0], 'end': [1],
'begin_mask': 8, 'end_mask': 3, 'shrink_axis_mask': None},
]
@ -24,7 +24,7 @@ class TestTFLiteStridedSliceLayerTest(TFLiteLayerTest):
allowed_ops = ['STRIDED_SLICE']
def _prepare_input(self, inputs_dict, generator=None):
if self.input_dtype == np.bool:
if self.input_dtype == bool:
inputs_dict['Input'] = np.random.choice([True, False], size=inputs_dict['Input'])
else:
inputs_dict['Input'] = np.random.randint(-255, 255, inputs_dict['Input']).astype(self.input_dtype)