static void process_layer(Dictionary <string, ILayer> created_layers, LayerConfig layer_data, Dictionary <ILayer, NodeConfig> unprocessed_nodes, Dictionary <ILayer, int> node_count_by_layer) { ILayer layer = null; var layer_name = layer_data.Name; if (created_layers.ContainsKey(layer_name)) { layer = created_layers[layer_name]; } else { layer = layer_data.ClassName switch { "InputLayer" => InputLayer.from_config(layer_data.Config), "Dense" => Dense.from_config(layer_data.Config), _ => throw new NotImplementedException("") }; created_layers[layer_name] = layer; } node_count_by_layer[layer] = _should_skip_first_node(layer) ? 1 : 0; var inbound_nodes_data = layer_data.InboundNodes; foreach (var node_data in inbound_nodes_data) { if (!unprocessed_nodes.ContainsKey(layer)) { unprocessed_nodes[layer] = node_data; } else { unprocessed_nodes.Add(layer, node_data); } } }