Get the `trainable` state of each sublayer. Returns: A dict mapping all sublayers to their `trainable` value.
(self)
| 2182 | return nest.map_structure(_make_placeholder_like, output_shapes) |
| 2183 | |
| 2184 | def _get_trainable_state(self): |
| 2185 | """Get the `trainable` state of each sublayer. |
| 2186 | |
| 2187 | Returns: |
| 2188 | A dict mapping all sublayers to their `trainable` value. |
| 2189 | """ |
| 2190 | layers = trackable_layer_utils.filter_empty_layer_containers(self._layers) |
| 2191 | # Keep track of each top-level layers' `trainable` as well as the |
| 2192 | # state of all of its sublayers. |
| 2193 | trainable_state = {self: self.trainable} |
| 2194 | for layer in layers: |
| 2195 | trainable_state.update(layer._get_trainable_state()) |
| 2196 | return trainable_state |
| 2197 | |
| 2198 | def _set_trainable_state(self, trainable_state): |
| 2199 | """Set `trainable` state for each sublayer.""" |
no test coverage detected