def __init__(self, layers=None, name=None): self.layers = [] # Stack of layers. self.model = None # Internal Model instance. self.inputs = [] # List of input tensors self.outputs = [] # List of length 1: the output tensor (unique). self._trainable = True self._initial_weights = None # Model attributes. self.inbound_nodes = [] self.outbound_nodes = [] self.built = False # Set model name. if not name: prefix = 'sequential_' name = prefix + str(K.get_uid(prefix)) self.name = name # The following properties are not actually used by Keras; # they exist for compatibility with TF's variable scoping mechanism. self._updates = [] self._losses = [] self._scope = None self._reuse = None self._base_name = name self._graph = ops.get_default_graph() # Add to the model any layers passed to the constructor. if layers: for layer in layers: self.add(layer)
def __init__(self, layers=None, name=None): self.layers = [] # Stack of layers. self.model = None # Internal Model instance. self.inputs = [] # List of input tensors self.outputs = [] # List of length 1: the output tensor (unique). self._trainable = True self._initial_weights = None # Model attributes. self.inbound_nodes = [] self.outbound_nodes = [] self.built = False # Set model name. if not name: prefix = 'sequential_' name = prefix + str(K.get_uid(prefix)) self.name = name # Add to the model any layers passed to the constructor. if layers: for layer in layers: self.add(layer)