Commit bf6402ad authored by Yuxin Wu's avatar Yuxin Wu

fix nested argscope (fix #1252)

parent 7e7e577f
...@@ -161,6 +161,7 @@ or when you need to filter your data on the fly. ...@@ -161,6 +161,7 @@ or when you need to filter your data on the fly.
but inefficient for generic data type or numpy arrays. but inefficient for generic data type or numpy arrays.
Also, its implementation [does not always clean up the subprocesses correctly](https://github.com/pytorch/pytorch/issues/16608). Also, its implementation [does not always clean up the subprocesses correctly](https://github.com/pytorch/pytorch/issues/16608).
Pytorch starts to improve on these bad assumptions (e.g., with [IterableDataset](https://github.com/pytorch/pytorch/pull/19228)).
On the other hand, DataFlow: On the other hand, DataFlow:
1. Is a pure iterator, not necessarily has a length or can be indexed. This is more generic. 1. Is a pure iterator, not necessarily has a length or can be indexed. This is more generic.
......
...@@ -49,7 +49,8 @@ def argscope(layers, **kwargs): ...@@ -49,7 +49,8 @@ def argscope(layers, **kwargs):
assert hasattr(l, 'symbolic_function'), "{} is not a registered layer".format(l.__name__) assert hasattr(l, 'symbolic_function'), "{} is not a registered layer".format(l.__name__)
# _check_args_exist(l.symbolic_function) # _check_args_exist(l.symbolic_function)
new_scope = copy.copy(get_arg_scope()) # need to deepcopy so that changes to new_scope does not affect outer scope
new_scope = copy.deepcopy(get_arg_scope())
for l in layers: for l in layers:
new_scope[l.__name__].update(kwargs) new_scope[l.__name__].update(kwargs)
_ArgScopeStack.append(new_scope) _ArgScopeStack.append(new_scope)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment