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
0247be5e
Unverified
Commit
0247be5e
authored
Jun 11, 2021
by
Yuge Zhang
Committed by
GitHub
Jun 11, 2021
Browse files
Remove deepcopy in Retiarii evaluator (#3812)
parent
4dc8c032
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
2 deletions
+1
-2
nni/retiarii/graph.py
nni/retiarii/graph.py
+1
-2
No files found.
nni/retiarii/graph.py
View file @
0247be5e
...
@@ -6,7 +6,6 @@ Model representation.
...
@@ -6,7 +6,6 @@ Model representation.
"""
"""
import
abc
import
abc
import
copy
import
json
import
json
from
enum
import
Enum
from
enum
import
Enum
from
typing
import
(
Any
,
Dict
,
Iterable
,
List
,
Optional
,
Tuple
,
Type
,
Union
,
overload
)
from
typing
import
(
Any
,
Dict
,
Iterable
,
List
,
Optional
,
Tuple
,
Type
,
Union
,
overload
)
...
@@ -143,7 +142,7 @@ class Model:
...
@@ -143,7 +142,7 @@ class Model:
new_model
.
python_class
=
self
.
python_class
new_model
.
python_class
=
self
.
python_class
new_model
.
python_init_params
=
self
.
python_init_params
new_model
.
python_init_params
=
self
.
python_init_params
new_model
.
graphs
=
{
name
:
graph
.
_fork_to
(
new_model
)
for
name
,
graph
in
self
.
graphs
.
items
()}
new_model
.
graphs
=
{
name
:
graph
.
_fork_to
(
new_model
)
for
name
,
graph
in
self
.
graphs
.
items
()}
new_model
.
evaluator
=
copy
.
deepcopy
(
self
.
evaluator
)
# TODO this
may be a problem when evaluator is large
new_model
.
evaluator
=
self
.
evaluator
# TODO this
needs a clever copy (not deepcopy) if we need mutation
new_model
.
history
=
[
*
self
.
history
]
new_model
.
history
=
[
*
self
.
history
]
# Note: the history is not updated. It will be updated when the model is changed, that is in mutator.
# Note: the history is not updated. It will be updated when the model is changed, that is in mutator.
return
new_model
return
new_model
...
...
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