-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Expand file tree
/
Copy pathtest_ravel.py
More file actions
41 lines (33 loc) · 1.07 KB
/
test_ravel.py
File metadata and controls
41 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Copyright (C) 2018-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from pytorch_layer_test_class import PytorchLayerTest
class TestRavel(PytorchLayerTest):
def _prepare_input(self, shape, dtype="float32"):
return (np.random.randn(*shape).astype(dtype),)
def create_model(self):
import torch
class aten_ravel(torch.nn.Module):
def forward(self, x):
return torch.ravel(x)
return aten_ravel(), "aten::ravel"
@pytest.mark.parametrize("shape", [
[2, 3],
[2, 3, 4],
[2, 3, 4, 5],
[1],
[5],
[1, 1, 1],
])
@pytest.mark.parametrize("dtype", ["float32", "float64", "int32", "int64", "int8"])
@pytest.mark.nightly
@pytest.mark.precommit
def test_ravel(self, shape, dtype, ie_device, precision, ir_version):
self._test(
*self.create_model(),
ie_device,
precision,
ir_version,
kwargs_to_prepare_input={"shape": shape, "dtype": dtype},
)