From 062893ff5b1440c2cda6f090334fd5992c0cfb06 Mon Sep 17 00:00:00 2001 From: Sheng Zha Date: Sat, 7 Oct 2017 16:00:32 -0700 Subject: [PATCH] update --- python/mxnet/gluon/block.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/python/mxnet/gluon/block.py b/python/mxnet/gluon/block.py index 05805666548f..099fae8fdbee 100644 --- a/python/mxnet/gluon/block.py +++ b/python/mxnet/gluon/block.py @@ -168,7 +168,6 @@ def __init__(self, prefix=None, params=None): self._name = self._prefix[:-1] if self._prefix.endswith('_') else self._prefix self._scope = _BlockScope(self) self._children = [] - self._collected_params = None def __repr__(self): s = '{name}(\n{modstr}\n)' @@ -189,7 +188,6 @@ def __setattr__(self, name, value): type1=type(existing), type2=type(value))) if isinstance(existing, Block): - self._unfreeze_children() for i, c in enumerate(self._children): if c is existing: self._children[i] = value @@ -203,17 +201,6 @@ def __setattr__(self, name, value): def _alias(self): return self.__class__.__name__.lower() - def _is_children_frozen(self): - return isinstance(self._children, tuple) - - def _freeze_children(self): - if not self._is_children_frozen(): - self._children = tuple(self._children) - - def _unfreeze_children(self): - if self._is_children_frozen(): - self._children = list(self._children) - @property def prefix(self): """Prefix of this :py:class:`Block`.""" @@ -242,15 +229,10 @@ def params(self): def collect_params(self): """Returns a :py:class:`ParameterDict` containing this :py:class:`Block` and all of its children's Parameters.""" - if self._is_children_frozen() and self._collected_params is not None: - return self._collected_params - - self._freeze_children() ret = ParameterDict(self._params.prefix) ret.update(self.params) for cld in self._children: ret.update(cld.collect_params()) - self._collected_params = ret return ret def save_params(self, filename): @@ -282,7 +264,6 @@ def load_params(self, filename, ctx, allow_missing=False, def register_child(self, block): """Registers block as a child of self. :py:class:`Block` s assigned to self as attributes will be registered automatically.""" - self._unfreeze_children() self._children.append(block) def initialize(self, init=initializer.Uniform(), ctx=None, verbose=False):