| 549 | self.add(l) |
| 550 | |
| 551 | def add(self, layer_func): |
| 552 | if isinstance(layer_func, base.Layer): |
| 553 | args = function_utils.fn_args(layer_func.call) |
| 554 | self.track_layer(layer_func) |
| 555 | elif callable(layer_func): |
| 556 | args = function_utils.fn_args(layer_func) |
| 557 | else: |
| 558 | raise TypeError( |
| 559 | "Sequential.add() takes only tf.layers.Layer objects or callables; " |
| 560 | "not '%s' of type '%s'." % (layer_func, type(layer_func))) |
| 561 | self._layers_funcs.append((("training" in args), layer_func)) |
| 562 | |
| 563 | def call(self, inputs, training=None): |
| 564 | """Call each Layer in the order they were added.""" |