/// <summary> /// Adds a layer instance on top of the layer stack. /// </summary> /// <param name="layer"></param> public void add(Layer layer) { built = false; var set_inputs = false; if (_layers.Count == 0) { if (layer is InputLayer) { } else { var(batch_shape, dtype) = (layer._batch_input_shape, layer._dtype); if (batch_shape != null) { // Instantiate an input layer. var x = keras.layers.Input( batch_shape: batch_shape, dtype: dtype, name: layer.name + "_input"); // This will build the current layer // and create the node connecting the current layer // to the input layer we just created. layer.__call__(x); set_inputs = true; } } if (set_inputs) { // If an input layer (placeholder) is available. // outputs = layer.inbound_nodes; } } if (set_inputs || _is_graph_network) { } }
/// <summary> /// Adds a layer instance on top of the layer stack. /// </summary> /// <param name="layer"></param> public void add(Layer layer) { built = false; var set_inputs = false; if (_layers.Count == 0) { var(batch_shape, dtype) = (layer._batch_input_shape, layer._dtype); if (batch_shape != null) { // Instantiate an input layer. var x = keras.layers.Input( batch_shape: batch_shape, dtype: dtype, name: layer.name + "_input"); // This will build the current layer // and create the node connecting the current layer // to the input layer we just created. layer.__call__(x); set_inputs = true; } } }