Configure the `Network`. Args: name: The name to use for this `Network`. If specified, it must be unique in the context where this `Network` is first (1) added to another `Network` (in which case it must not share a name with other `Layers` added to that `Network`)
(self, name=None)
| 150 | |
| 151 | @deprecation.deprecated(date=None, instructions=_NETWORK_DEPRECATION_MESSAGE) |
| 152 | def __init__(self, name=None): |
| 153 | """Configure the `Network`. |
| 154 | |
| 155 | Args: |
| 156 | name: The name to use for this `Network`. If specified, it must be unique |
| 157 | in the context where this `Network` is first (1) added to another |
| 158 | `Network` (in which case it must not share a name with other `Layers` |
| 159 | added to that `Network`), or (2) built/called (in which case no other |
| 160 | 'top-level' `Network`s may share this name). If unspecified or None, the |
| 161 | `Network` will be named using its class name, with a number appended if |
| 162 | necessary for uniqueness (e.g. MyNetwork -> 'my_network_1'). |
| 163 | |
| 164 | Raises: |
| 165 | ValueError: If `name` is not valid. Note that some naming errors will |
| 166 | instead be raised when the `Network` is called. |
| 167 | """ |
| 168 | if context.executing_eagerly(): |
| 169 | logging.warning( |
| 170 | ("** tfe.Network is deprecated and will be removed in a future " |
| 171 | "version.\n\n%s"), _NETWORK_DEPRECATION_MESSAGE) |
| 172 | if isinstance(name, variable_scope.VariableScope): |
| 173 | raise ValueError("VariableScopes are not valid Network names.") |
| 174 | if name is not None and "/" in name: |
| 175 | raise ValueError( |
| 176 | "Forward slashes ('/') are not allowed in Network names.") |
| 177 | super(Network, self).__init__(name=name) |
| 178 | self._layers = [] |
| 179 | self._sub_layer_name_uids = collections.defaultdict(int) |
| 180 | # Initially None, but set to False for networks which are first built as |
| 181 | # top-level. |
| 182 | self._first_parent = None # A weak reference to our first parent. |
| 183 | self._non_network_sublayers = [] |
| 184 | self._owned_layers = {} |
| 185 | # The scope to use if we end up without a parent. |
| 186 | self._default_parent_variable_scope = variable_scope.get_variable_scope() |
| 187 | # Hold on to the variable scope counts from init to check whether a scope |
| 188 | # with the name we want was ever created in our parent scope. Without this |
| 189 | # check we might have name collisions if the parent scope on init gets |
| 190 | # closed before build is called. |
| 191 | self._variable_scope_counts_on_init = ( |
| 192 | variable_scope.get_variable_scope_store().variable_scopes_count) |
| 193 | |
| 194 | def _gather_saveables_for_checkpoint(self): |
| 195 | raise NotImplementedError( |
no test coverage detected