def _set_scope(self, scope):
"""Set the given scope as the scope of the layer.
If not already present, set the scope for the layer. The name of such scope
will be accessible through the `self.scope` property.
Argsuments:
scope: the given scope, of type `str` of `tf.VariableScope`. If `None`,
the one returned from the `self._default_scope()` method will be used.
"""
if self._scope is None:
if self._reuse:
self._scope = next(tf.variable_scope( # pylint: disable=I0011,E1101
scope if scope is not None else self._default_scope()).gen)
else:
self._scope = next(tf.variable_scope( # pylint: disable=I0011,E1101
scope, default_name=self._default_scope().name).gen)
评论列表
文章目录