def extract_metadata(graph_def):
  """Attempt to extract meta data hidden in graph_def.

  Looks for a `__lucid_metadata_json` constant string op.
  If present, extract it's content and convert it from json to python.
  If not, returns None.
  """
  meta_matches = [n for n in graph_def.node if n.name==metadata_node_name]
  if meta_matches:
    assert len(meta_matches) == 1, "found more than 1 lucid metadata node!"
    meta_tensor = meta_matches[0].attr['value'].tensor
    return json.loads(meta_tensor.string_val[0])
  else:
    return None
def extract_metadata ( graph_def ) : meta_matches = [ n for n in graph_def . node if n . name == metadata_node_name ] if meta_matches : assert len ( meta_matches ) == 1 , "found more than 1 lucid metadata node!" meta_tensor = meta_matches [ 0 ] . attr [ 'value' ] . tensor return json . loads ( meta_tensor . string_val [ 0 ] ) else : return None
Attempt to extract meta data hidden in graph_def.

  Looks for a `__lucid_metadata_json` constant string op.
  If present, extract it's content and convert it from json to python.
  If not, returns None.