pyspark/bigdl/keras/converter.py
def __build_node_id_2_klayer(kmodel, node_id_to_config_layer):
        """
        The result would contain all of the layers including nested layers.
        :param kmodel: a keras model which can be Sequential or Model
        :param node_id_to_config_layer: a container to store the result
        """
        node_id_to_config_layer[kmodel.name] = kmodel  # include itself as well
        def gather_result(layers):
            if layers:  # layers maybe None here.
                for layer in layers:
                    if layer.name not in node_id_to_config_layer:
                        node_id_to_config_layer[layer.name] = layer
                        DefinitionLoader.__build_node_id_2_klayer(layer, node_id_to_config_layer)
        if hasattr(kmodel, "layers"):
            gather_result(kmodel.layers)
        if hasattr(kmodel, "flattened_layers"):
            gather_result(kmodel.flattened_layers)
def __build_node_id_2_klayer(kmodel, node_id_to_config_layer):
        """
        The result would contain all of the layers including nested layers.
        :param kmodel: a keras model which can be Sequential or Model
        :param node_id_to_config_layer: a container to store the result
        """
        node_id_to_config_layer[kmodel.name] = kmodel  # include itself as well
        def gather_result(layers):
            if layers:  # layers maybe None here.
                for layer in layers:
                    if layer.name not in node_id_to_config_layer:
                        node_id_to_config_layer[layer.name] = layer
                        DefinitionLoader.__build_node_id_2_klayer(layer, node_id_to_config_layer)
        if hasattr(kmodel, "layers"):
            gather_result(kmodel.layers)
        if hasattr(kmodel, "flattened_layers"):
            gather_result(kmodel.flattened_layers)
def __build_node_id_2_klayer ( kmodel , node_id_to_config_layer ) : node_id_to_config_layer [ kmodel . name ] = kmodel # include itself as well def gather_result ( layers ) : if layers : # layers maybe None here. for layer in layers : if layer . name not in node_id_to_config_layer : node_id_to_config_layer [ layer . name ] = layer DefinitionLoader . __build_node_id_2_klayer ( layer , node_id_to_config_layer ) if hasattr ( kmodel , "layers" ) : gather_result ( kmodel . layers ) if hasattr ( kmodel , "flattened_layers" ) : gather_result ( kmodel . flattened_layers )
The result would contain all of the layers including nested layers.
        :param kmodel: a keras model which can be Sequential or Model
        :param node_id_to_config_layer: a container to store the result
The result would contain all of the layers including nested layers . : param kmodel : a keras model which can be Sequential or Model : param node_id_to_config_layer : a container to store the result