def METHOD_NAME(model_file):
  graph = tf.Graph()
  graph_def = tf.compat.v1.GraphDef()
  import os
  file_ext = os.path.splitext(model_file)[1]
  with open(model_file, "rb") as f:
    if file_ext == '.pbtxt':
      text_format.Merge(f.read(), graph_def)
    else:
      graph_def.ParseFromString(f.read())
  with graph.as_default():
    tf.import_graph_def(graph_def, name='')
  return graph