Skip to content

Commit

Permalink
replaced random_sample with randn
Browse files Browse the repository at this point in the history
  • Loading branch information
mryzhov committed Oct 24, 2023
1 parent b7ecd4f commit 4361c6f
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 33 deletions.
6 changes: 3 additions & 3 deletions tests/layer_tests/pytorch_tests/test_adaptive_avg_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def forward(self, input_shape):
@pytest.mark.precommit_ts_backend
@pytest.mark.precommit_fx_backend
def test_adaptive_avg_pool3d(self, ie_device, precision, ir_version, input_shape, output_size):
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
self._test(*self.create_model(output_size), ie_device, precision, ir_version)


Expand Down Expand Up @@ -64,7 +64,7 @@ def forward(self, input_tensor):
@pytest.mark.precommit_ts_backend
@pytest.mark.precommit_fx_backend
def test_adaptive_avg_pool2d(self, ie_device, precision, ir_version, input_shape, output_size):
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
self._test(*self.create_model(output_size), ie_device, precision, ir_version)


Expand Down Expand Up @@ -94,7 +94,7 @@ def forward(self, input_tensor):
@pytest.mark.precommit_ts_backend
@pytest.mark.precommit_fx_backend
def test_adaptive_avg_pool1d(self, ie_device, precision, ir_version, input_shape, output_size):
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
self._test(*self.create_model(output_size), ie_device, precision, ir_version)


6 changes: 3 additions & 3 deletions tests/layer_tests/pytorch_tests/test_adaptive_max_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def forward(self, input_tensor):
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() == 'arm64',
reason='Ticket - 122715')
def test_adaptive_max_pool3d(self, ie_device, precision, ir_version, input_shape, output_size, return_indices):
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
self._test(*self.create_model(output_size, return_indices), ie_device, precision, ir_version)


Expand Down Expand Up @@ -97,7 +97,7 @@ def forward(self, input_tensor):
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() == 'arm64',
reason='Ticket - 122715')
def test_adaptive_max_pool2d(self, ie_device, precision, ir_version, input_shape, output_size, return_indices):
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
self._test(*self.create_model(output_size, return_indices), ie_device, precision, ir_version)


Expand Down Expand Up @@ -144,5 +144,5 @@ def forward(self, input_tensor):
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() == 'arm64',
reason='Ticket - 122715')
def test_adaptive_max_pool1d(self, ie_device, precision, ir_version, input_shape, output_size, return_indices):
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
self._test(*self.create_model(output_size, return_indices), ie_device, precision, ir_version)
2 changes: 1 addition & 1 deletion tests/layer_tests/pytorch_tests/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def forward2(self, lhs, rhs):
@pytest.mark.precommit_fx_backend
@pytest.mark.parametrize("op_type", ["add", "add_"])
def test_add(self, ie_device, precision, ir_version, alpha, input_shape_rhs, op_type):
self.input_rhs = np.random.random_sample(input_shape_rhs).astype(np.float32)
self.input_rhs = np.random.randn(*input_shape_rhs).astype(np.float32)
self._test(*self.create_model(alpha, op_type), ie_device, precision, ir_version, use_convert_model=True)


Expand Down
2 changes: 1 addition & 1 deletion tests/layer_tests/pytorch_tests/test_argsort.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def forward(self, input_tensor):
def test_argsort(self, tensor_stable_pair, descending, ie_device, precision, ir_version):
input_shape, stable = tensor_stable_pair
if type(input_shape) is list:
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
else:
self.input_tensor = input_shape
dims = len(self.input_tensor.shape)
Expand Down
4 changes: 2 additions & 2 deletions tests/layer_tests/pytorch_tests/test_floor_divide.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def forward(self, input_tensor, other_tensor):
reason='Ticket - 122715')
def test_floor_divide(self, input_tensor, other_tensor, ie_device, precision, ir_version):
if type(input_tensor) is list:
self.input_tensor = np.random.random_sample(input_tensor).astype(np.float32)
self.input_tensor = np.random.randn(*input_tensor).astype(np.float32)
else:
self.input_tensor = input_tensor
if type(other_tensor) is list:
self.other_tensor = np.random.random_sample(other_tensor).astype(np.float32)
self.other_tensor = np.random.randn(*other_tensor).astype(np.float32)
else:
self.other_tensor = other_tensor
self._test(*self.create_model(), ie_device, precision, ir_version, trace_model=True, use_convert_model=True)
Expand Down
6 changes: 3 additions & 3 deletions tests/layer_tests/pytorch_tests/test_index_put_.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def forward(self, input_tensor, values):
@pytest.mark.nightly
@pytest.mark.precommit
def test_index_put_single_indices(self, ie_device, precision, ir_version, input_data, indices, accumulate):
self.input_tensor = np.random.random_sample(input_data["input_shape"]).astype(np.float32)
self.input_tensor = np.random.randn(*input_data["input_shape"]).astype(np.float32)
self.values = input_data["values"]
self._test(*self.create_model(indices, accumulate), ie_device, precision, ir_version)

Expand Down Expand Up @@ -107,7 +107,7 @@ def forward(self, input_tensor, values):
@pytest.mark.nightly
@pytest.mark.precommit
def test_index_put_many_indices(self, ie_device, precision, ir_version, input_data, indices, accumulate):
self.input_tensor = np.random.random_sample(input_data["input_shape"]).astype(np.float32)
self.input_tensor = np.random.randn(*input_data["input_shape"]).astype(np.float32)
self.values = input_data["values"]
self._test(*self.create_model(indices, accumulate), ie_device, precision, ir_version)

Expand Down Expand Up @@ -158,7 +158,7 @@ def forward(self, input_tensor, values, indices_0, indices_1):
@pytest.mark.nightly
@pytest.mark.precommit
def test_nonzero_index_put_(self, ie_device, precision, ir_version, input_data, indices, accumulate):
self.input_tensor = np.random.random_sample(input_data["input_shape"]).astype(np.float32)
self.input_tensor = np.random.randn(*input_data["input_shape"]).astype(np.float32)
self.values = input_data["values"]
for i in range(len(indices)):
if type(indices[i]) is list:
Expand Down
4 changes: 2 additions & 2 deletions tests/layer_tests/pytorch_tests/test_len.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ def forward(self, input_tensor):
@pytest.mark.nightly
@pytest.mark.precommit
def test_len(self, ie_device, precision, ir_version, input_tensor):
self.input_tensor = np.random.random_sample(input_tensor).astype(np.float32)
self.input_tensor = np.random.randn(*input_tensor).astype(np.float32)
self._test(*self.create_model(), ie_device, precision, ir_version)

@pytest.mark.nightly
@pytest.mark.precommit
def test_len_int_list(self, ie_device, precision, ir_version, input_tensor):
self.input_tensor = np.random.random_sample(input_tensor).astype(np.float32)
self.input_tensor = np.random.randn(*input_tensor).astype(np.float32)
self._test(*self.create_model_int_list(),
ie_device, precision, ir_version, use_convert_model=True)

Expand Down
2 changes: 1 addition & 1 deletion tests/layer_tests/pytorch_tests/test_narrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def forward(self, input_tensor, dim: int, start, length: int):
@pytest.mark.nightly
@pytest.mark.precommit
def test_narrow(self, input_shape, dim, start, length, ie_device, precision, ir_version):
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
self.dim = dim
self.start = start
self.length = length
Expand Down
2 changes: 1 addition & 1 deletion tests/layer_tests/pytorch_tests/test_remainder.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def forward(self, lhs, rhs):
@pytest.mark.nightly
@pytest.mark.precommit
def test_remainder(self, ie_device, precision, ir_version, input_shape_rhs):
self.input_rhs = np.random.random_sample(input_shape_rhs).astype(np.float32)
self.input_rhs = np.random.randn(*input_shape_rhs).astype(np.float32)
self._test(*self.create_model(), ie_device, precision, ir_version, use_convert_model=True)


Expand Down
2 changes: 1 addition & 1 deletion tests/layer_tests/pytorch_tests/test_roi_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def forward(self, input_tensor, rois):
@pytest.mark.precommit
def test_roi_align(self, ie_device, precision, ir_version, input_shape, boxes, output_size,
spatial_scale, sampling_ratio, aligned):
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
self.boxes = boxes
self._test(*self.create_model(output_size, spatial_scale, sampling_ratio, aligned),
ie_device, precision, ir_version, trace_model=True)
4 changes: 2 additions & 2 deletions tests/layer_tests/pytorch_tests/test_rsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_rsub(self, ie_device, precision, ir_version, input_data):
self.input_data = []
for input in input_data:
if type(input) is list:
self.input_data.append(np.random.random_sample(input).astype(np.float32))
self.input_data.append(np.random.randn(*input).astype(np.float32))
else:
self.input_data.append(input)
self._test(*self.create_model(second_type="float"), ie_device, precision, ir_version, use_convert_model=True)
Expand All @@ -59,7 +59,7 @@ def test_rsub(self, ie_device, precision, ir_version, input_data):
self.input_data = []
for input in input_data:
if type(input) is list:
self.input_data.append(np.random.random_sample(input).astype(np.float32))
self.input_data.append(np.random.randn(*input).astype(np.float32))
else:
self.input_data.append(input)
self._test(*self.create_model(second_type="int"), ie_device, precision, ir_version)
Expand Down
2 changes: 1 addition & 1 deletion tests/layer_tests/pytorch_tests/test_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def forward(self, input_tensor):
def test_sort(self, input_shape, descending, stable, ie_device, precision, ir_version):
self.input_tensor = []
if type(input_shape) is list:
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
else:
self.input_tensor = input_shape
dims = len(self.input_tensor.shape)
Expand Down
10 changes: 5 additions & 5 deletions tests/layer_tests/pytorch_tests/test_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def forward(self, x, y):
@pytest.mark.precommit
def test_stack2D(self, input_shape, dim, ie_device, precision, ir_version):
self.input_tensors = [
np.random.random_sample(input_shape).astype(np.float32),
np.random.random_sample(input_shape).astype(np.float32),
np.random.randn(*input_shape).astype(np.float32),
np.random.randn(*input_shape).astype(np.float32),
]
self._test(*self.create_model(dim), ie_device, precision, ir_version)

Expand Down Expand Up @@ -79,8 +79,8 @@ def forward(self, x, y, z):
@pytest.mark.precommit
def test_stack3D(self, input_shape, dim, ie_device, precision, ir_version):
self.input_tensors = [
np.random.random_sample(input_shape).astype(np.float32),
np.random.random_sample(input_shape).astype(np.float32),
np.random.random_sample(input_shape).astype(np.float32)
np.random.randn(*input_shape).astype(np.float32),
np.random.randn(*input_shape).astype(np.float32),
np.random.randn(*input_shape).astype(np.float32)
]
self._test(*self.create_model(dim), ie_device, precision, ir_version)
2 changes: 1 addition & 1 deletion tests/layer_tests/pytorch_tests/test_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _forward_inplace(self, x, y, alpha: float):
def test_sub(self, ie_device, precision, ir_version, input_shapes, inplace):
self.input_data = []
for input_shape in input_shapes:
self.input_data.append(np.random.random_sample(input_shape).astype(np.float32))
self.input_data.append(np.random.randn(*input_shape).astype(np.float32))
self._test(*self.create_model(inplace), ie_device, precision, ir_version, use_convert_model=True)


Expand Down
2 changes: 1 addition & 1 deletion tests/layer_tests/pytorch_tests/test_topk.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ def forward(self, input_tensor):
@pytest.mark.precommit
@pytest.mark.skipif(os.getenv("GITHUB_ACTIONS") == 'true', reason="Ticket - 115085")
def test_topK(self, input_shape, k, dim, largest, sort, ie_device, precision, ir_version):
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
self._test(*self.create_model(k, dim, largest, sort), ie_device, precision, ir_version)
2 changes: 1 addition & 1 deletion tests/layer_tests/pytorch_tests/test_unfold.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ def forward(self, input_tensor):
@pytest.mark.nightly
@pytest.mark.precommit
def test_unfold(self, ie_device, precision, ir_version, dimension, size, step, input_shape):
self.input_tensor = np.random.random_sample(input_shape).astype(np.float32)
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
self._test(*self.create_model(dimension, size, step),
ie_device, precision, ir_version)
8 changes: 4 additions & 4 deletions tests/layer_tests/pytorch_tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_view_list_construct(self, ie_device, precision, ir_version, input_shape
self.input_data = []
for input_shape in input_shapes:
if type(input_shape) is list:
self.input_data.append(np.random.random_sample(input_shape).astype(np.float32))
self.input_data.append(np.random.randn(*input_shape).astype(np.float32))
else:
self.input_data.append(input_shape)
self._test(*self.create_model(), ie_device, precision, ir_version)
Expand Down Expand Up @@ -70,7 +70,7 @@ def test_view_dtype(self, ie_device, precision, ir_version, input_shapes):
self.input_data = []
for input_shape in input_shapes:
if type(input_shape) is list:
self.input_data.append(np.random.random_sample(input_shape).astype(np.float32))
self.input_data.append(np.random.randn(*input_shape).astype(np.float32))
else:
self.input_data.append(input_shape)
self._test(*self.create_model(), ie_device, precision, ir_version)
Expand Down Expand Up @@ -103,7 +103,7 @@ def test_view_size(self, ie_device, precision, ir_version, input_shapes):
self.input_data = []
for input_shape in input_shapes:
if type(input_shape) is list:
self.input_data.append(np.random.random_sample(input_shape).astype(np.float32))
self.input_data.append(np.random.randn(*input_shape).astype(np.float32))
else:
self.input_data.append(input_shape)
self._test(*self.create_model(), ie_device, precision, ir_version)
Expand Down Expand Up @@ -146,7 +146,7 @@ def test_view(self, ie_device, precision, ir_version, input_shapes):
self.input_data = []
for input_shape in input_shapes:
if type(input_shape) is list:
self.input_data.append(np.random.random_sample(input_shape).astype(np.float32))
self.input_data.append(np.random.randn(*input_shape).astype(np.float32))
else:
self.input_data.append(input_shape)
self._test(*self.create_model(), ie_device, precision, ir_version)

0 comments on commit 4361c6f

Please sign in to comment.