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
8e1b7655
Unverified
Commit
8e1b7655
authored
May 18, 2020
by
Himashi Amanda Peiris
Committed by
GitHub
May 18, 2020
Browse files
updated unit tests of network morphism tuner (#2427)
parent
f42e53d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/sdk/pynni/nni/networkmorphism_tuner/test_networkmorphism_tuner.py
...i/nni/networkmorphism_tuner/test_networkmorphism_tuner.py
+2
-2
No files found.
src/sdk/pynni/nni/networkmorphism_tuner/test_networkmorphism_tuner.py
View file @
8e1b7655
...
@@ -102,7 +102,7 @@ class NetworkMorphismTestCase(TestCase):
...
@@ -102,7 +102,7 @@ class NetworkMorphismTestCase(TestCase):
graph_init
=
CnnGenerator
(
10
,
(
32
,
32
,
3
)).
generate
()
graph_init
=
CnnGenerator
(
10
,
(
32
,
32
,
3
)).
generate
()
json_out
=
graph_to_json
(
graph_init
,
"temp.json"
)
json_out
=
graph_to_json
(
graph_init
,
"temp.json"
)
graph_recover
=
json_to_graph
(
json_out
)
graph_recover
=
json_to_graph
(
json_out
)
deeper_graph
=
to_
wid
er_graph
(
deepcopy
(
graph_recover
))
deeper_graph
=
to_
deep
er_graph
(
deepcopy
(
graph_recover
))
model
=
deeper_graph
.
produce_torch_model
()
model
=
deeper_graph
.
produce_torch_model
()
out
=
model
(
torch
.
ones
(
1
,
3
,
32
,
32
))
out
=
model
(
torch
.
ones
(
1
,
3
,
32
,
32
))
self
.
assertEqual
(
out
.
shape
,
torch
.
Size
([
1
,
10
]))
self
.
assertEqual
(
out
.
shape
,
torch
.
Size
([
1
,
10
]))
...
@@ -114,7 +114,7 @@ class NetworkMorphismTestCase(TestCase):
...
@@ -114,7 +114,7 @@ class NetworkMorphismTestCase(TestCase):
graph_init
=
CnnGenerator
(
10
,
(
32
,
32
,
3
)).
generate
()
graph_init
=
CnnGenerator
(
10
,
(
32
,
32
,
3
)).
generate
()
json_out
=
graph_to_json
(
graph_init
,
"temp.json"
)
json_out
=
graph_to_json
(
graph_init
,
"temp.json"
)
graph_recover
=
json_to_graph
(
json_out
)
graph_recover
=
json_to_graph
(
json_out
)
skip_connection_graph
=
to_
wider
_graph
(
deepcopy
(
graph_recover
))
skip_connection_graph
=
to_
skip_connection
_graph
(
deepcopy
(
graph_recover
))
model
=
skip_connection_graph
.
produce_torch_model
()
model
=
skip_connection_graph
.
produce_torch_model
()
out
=
model
(
torch
.
ones
(
1
,
3
,
32
,
32
))
out
=
model
(
torch
.
ones
(
1
,
3
,
32
,
32
))
self
.
assertEqual
(
out
.
shape
,
torch
.
Size
([
1
,
10
]))
self
.
assertEqual
(
out
.
shape
,
torch
.
Size
([
1
,
10
]))
...
...
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