def with_name(self, name):
    """Sets the name scope for future operations."""
    with self.g.as_default(), scopes.var_and_name_scope((name, None)) as (
        name_scope, var_scope):
      return Layer(copy=self, name=self._name, scope=(name_scope, var_scope))