parameters: (model, prefix)
return_statement: return result
docstring: Serialize all weights of the models layers
docstring_summary: Serialize all weights of the models layers
docstring_tokens: Serialize all weights of the models layers
function: def get_all_weights(model, prefix):
      """Serialize all weights of the models layers"""
      result = {}
      layers = model.layers
      assert K.image_data_format() == 'channels_last'
      for layer in layers:
          for node in layer.inbound_nodes:
              if "training" in node.call_kwargs:
                  assert node.call_kwargs["training"] is not True, \
                      "training=true is not supported, see https://github.com/Dobiasd/frugally-deep/issues/284"
          layer_type = type(layer).__name__
          name = prefix + layer.name
          assert is_ascii(name)
          if name in result:
              raise ValueError('duplicate layer name ' + name)
          if layer_type in ['Model', 'Sequential', 'Functional']:
              result = merge_two_disjunct_dicts(result, get_all_weights(layer, name + '_'))
          elif layer_type in ['TimeDistributed'] and type(layer.layer).__name__ in ['Model', 'Sequential', 'Functional']:
              inner_layer = layer.layer
              result = merge_two_disjunct_dicts(result, get_layer_weights(layer, name))
              result = merge_two_disjunct_dicts(result, get_all_weights(inner_layer, name + "_"))
          else:
              result = merge_two_disjunct_dicts(result, get_layer_weights(layer, name))
      return result
function_tokens: def get_all_weights ( model , prefix ) : result = { } layers = model . layers assert K . image_data_format ( ) == 'channels_last' for layer in layers : for node in layer . inbound_nodes : if "training" in node . call_kwargs : assert node . call_kwargs [ "training" ] is not True , "training=true is not supported, see https://github.com/Dobiasd/frugally-deep/issues/284" layer_type = type ( layer ) . __name__ name = prefix + layer . name assert is_ascii ( name ) if name in result : raise ValueError ( 'duplicate layer name ' + name ) if layer_type in [ 'Model' , 'Sequential' , 'Functional' ] : result = merge_two_disjunct_dicts ( result , get_all_weights ( layer , name + '_' ) ) elif layer_type in [ 'TimeDistributed' ] and type ( layer . layer ) . __name__ in [ 'Model' , 'Sequential' , 'Functional' ] : inner_layer = layer . layer result = merge_two_disjunct_dicts ( result , get_layer_weights ( layer , name ) ) result = merge_two_disjunct_dicts ( result , get_all_weights ( inner_layer , name + "_" ) ) else : result = merge_two_disjunct_dicts ( result , get_layer_weights ( layer , name ) ) return result