Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
0058fbc2
You need to sign in or sign up before continuing.
Unverified
Commit
0058fbc2
authored
Aug 24, 2022
by
Louis-J
Committed by
GitHub
Aug 24, 2022
Browse files
test(speedup): add tests for aten::split and aten::leaky_relu (#5070)
parent
792a0a91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
test/algo/compression/v2/test_auto_conv.py
test/algo/compression/v2/test_auto_conv.py
+8
-6
No files found.
test/algo/compression/v2/test_auto_conv.py
View file @
0058fbc2
...
@@ -47,8 +47,8 @@ class TorchModel1(torch.nn.Module):
...
@@ -47,8 +47,8 @@ class TorchModel1(torch.nn.Module):
"""
"""
test for:
test for:
add, sub, mul, div, exp, matmul,
add, sub, mul, div, exp, matmul,
relu, gelu, tanh, silu, sigmod, softmax,
relu, gelu, tanh, silu, sigmod, softmax,
leaky_relu,
size, unsqueeze, flatten, cat, slice, reshape, transpose, t, select, permute, constant_pad_nd,
size, unsqueeze, flatten, cat, slice, reshape, transpose, t, select, permute, constant_pad_nd,
split
mean, avg_pool2d, max_pool2d, sum, adaptive_avg_pool2d,
mean, avg_pool2d, max_pool2d, sum, adaptive_avg_pool2d,
to, Int, view,
to, Int, view,
type_as, expand_as, contiguous,
type_as, expand_as, contiguous,
...
@@ -89,8 +89,9 @@ class TorchModel1(torch.nn.Module):
...
@@ -89,8 +89,9 @@ class TorchModel1(torch.nn.Module):
x
=
self
.
conv1
(
x
)
x
=
self
.
conv1
(
x
)
y1
=
self
.
pool1
(
F
.
relu
(
x
))
y1
=
self
.
pool1
(
F
.
relu
(
x
))
y2
=
self
.
pool1
(
F
.
gelu
(
x
))
y2
=
self
.
pool1
(
F
.
gelu
(
x
))
y3
=
self
.
pool1
(
F
.
leaky_relu
(
x
))
x
=
y1
+
y2
x
=
y1
+
y2
+
y3
x
=
x
+
0.00001
x
=
x
+
0.00001
...
@@ -133,8 +134,9 @@ class TorchModel1(torch.nn.Module):
...
@@ -133,8 +134,9 @@ class TorchModel1(torch.nn.Module):
x
=
x
.
type_as
(
x
)
x
=
x
.
type_as
(
x
)
x
=
x
.
expand_as
(
x
)
x
=
x
.
expand_as
(
x
)
x
=
torch
.
matmul
(
x
,
x
.
t
())
x
=
torch
.
matmul
(
x
,
x
.
t
())
x
=
torch
.
cat
([
x
,
x
],
dim
=
1
)
x
=
torch
.
split
(
x
,
1
,
dim
=
1
)
# x = self.cond(x)
x
=
torch
.
cat
(
x
,
dim
=
1
)
# x = self.cond(x) # condition is not support now
x
=
self
.
asub
(
x
)
x
=
self
.
asub
(
x
)
x
=
torch
.
constant_pad_nd
(
x
,
(
1
,
1
,
1
,
1
),
3.14159
)
x
=
torch
.
constant_pad_nd
(
x
,
(
1
,
1
,
1
,
1
),
3.14159
)
...
@@ -159,7 +161,7 @@ class AutoConvTestCase(unittest.TestCase):
...
@@ -159,7 +161,7 @@ class AutoConvTestCase(unittest.TestCase):
assert
0.45
<
real_sparsity_list
[
0
][
'total_sparsity'
]
<
0.75
assert
0.45
<
real_sparsity_list
[
0
][
'total_sparsity'
]
<
0.75
print
(
'the shape of output of the infer:'
,
model
(
dummy_input
).
shape
)
print
(
'the shape of output of the infer:'
,
model
(
dummy_input
).
shape
)
assert
model
(
dummy_input
).
shape
==
torch
.
Size
((
5
,
8
))
assert
model
(
dummy_input
).
shape
==
torch
.
Size
((
5
,
5
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment