-
Notifications
You must be signed in to change notification settings - Fork 409
Expand file tree
/
Copy pathtest_sigmoid_aten.py
More file actions
61 lines (48 loc) · 1.72 KB
/
Copy pathtest_sigmoid_aten.py
File metadata and controls
61 lines (48 loc) · 1.72 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import torch
import torch.nn as nn
from torch.testing._internal.common_utils import run_tests
from torch_tensorrt import Input
from .harness import DispatchTestCase
class TestSigmoidConverter(DispatchTestCase):
def test_sigmoid(self):
class TestModule(nn.Module):
def forward(self, x):
return torch.ops.aten.sigmoid.default(x)
inputs = [torch.randn(1, 10)]
self.run_test(TestModule(), inputs)
def test_sigmoid_with_dynamic_shape(self):
class TestModule(nn.Module):
def forward(self, x):
return torch.ops.aten.sigmoid.default(x)
input_specs = [
Input(
shape=(-1, -1, -1),
dtype=torch.float32,
shape_ranges=[((1, 1, 1), (1, 2, 3), (3, 3, 3))],
),
]
self.run_test_with_dynamic_shape(TestModule(), input_specs)
def test_sigmoid_with_dynamic_shape_four_dimensions(self):
class TestModule(nn.Module):
def forward(self, x):
return torch.ops.aten.sigmoid.default(x)
input_specs = [
Input(
shape=(-1, -1, -1, -1),
dtype=torch.float32,
shape_ranges=[((1, 1, 1, 5), (1, 2, 3, 5), (3, 3, 3, 5))],
),
]
self.run_test_with_dynamic_shape(TestModule(), input_specs)
def test_sigmoid_fp16(self):
class TestModule(nn.Module):
def forward(self, x):
return torch.ops.aten.sigmoid.default(x)
inputs = [torch.randn(1, 10, dtype=torch.float16)]
self.run_test(
TestModule(),
inputs,
check_dtype=False,
)
if __name__ == "__main__":
run_tests()