Skip to content

Commit

Permalink
Remove deepcopy in Retiarii evaluator (microsoft#3812)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultmaster authored Jun 11, 2021
1 parent 4dc8c03 commit 0247be5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions nni/retiarii/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""

import abc
import copy
import json
from enum import Enum
from typing import (Any, Dict, Iterable, List, Optional, Tuple, Type, Union, overload)
Expand Down Expand Up @@ -143,7 +142,7 @@ def fork(self) -> 'Model':
new_model.python_class = self.python_class
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.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]
# Note: the history is not updated. It will be updated when the model is changed, that is in mutator.
return new_model
Expand Down

0 comments on commit 0247be5

Please sign in to comment.