Removes the last layer in the model. Raises: TypeError: if there are no layers in the model.
(self)
| 216 | |
| 217 | @trackable.no_automatic_dependency_tracking |
| 218 | def pop(self): |
| 219 | """Removes the last layer in the model. |
| 220 | |
| 221 | Raises: |
| 222 | TypeError: if there are no layers in the model. |
| 223 | """ |
| 224 | if not self.layers: |
| 225 | raise TypeError('There are no layers in the model.') |
| 226 | |
| 227 | layer = self._layers.pop() |
| 228 | self._layer_call_argspecs.pop(layer) |
| 229 | if not self.layers: |
| 230 | self.outputs = None |
| 231 | self.inputs = None |
| 232 | self.built = False |
| 233 | elif self._is_graph_network: |
| 234 | self.layers[-1]._outbound_nodes = [] |
| 235 | self.outputs = [self.layers[-1].output] |
| 236 | self._init_graph_network(self.inputs, self.outputs, name=self.name) |
| 237 | self.built = True |
| 238 | |
| 239 | @base_layer_utils.default |
| 240 | def build(self, input_shape=None): |