Skip to content

Instantly share code, notes, and snippets.

@yoel-zeldes
Last active December 9, 2018 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoel-zeldes/3c1a3e5eff45f8035b4321739d5de436 to your computer and use it in GitHub Desktop.
Save yoel-zeldes/3c1a3e5eff45f8035b4321739d5de436 to your computer and use it in GitHub Desktop.
class TfFs(fuse.Operations):
def __init__(self, mount_point, model_path):
self._graph, self._session = _load_model(model_path)
self._files = {}
self._bin_scripts = {}
self._tensor_values = {}
now = time()
self._files['/'] = _create_dir(now)
self._files['/bin'] = _create_dir(now)
self._populate_bin(mount_point)
for op in self._graph.get_operations():
for tensor in op.outputs:
next_slash_index = 0
while next_slash_index >= 0:
next_slash_index = tensor.name.find('/', next_slash_index + 1)
if next_slash_index >= 0:
key = '/' + tensor.name[:next_slash_index]
if key not in self._files:
self._files[key] = _create_dir(now)
self._files['/' + tensor.name] = _create_tensor_file(tensor)
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment