google-deepmind / google-deepmind/scalable_agent

How to freeze the test / inference graph?

Open
#24 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1k
Forks
160
PR merge metrics
No merged PRs in 30d

Description

I am trying to freeze the graph to be able to optimize for inference.

I have printed out all the nodes and have plotted them on tensorboard but cannot determine the output nodes that I should mention for the frozen graph. Attached below is the part where I am trying to freeze the graph. This is on the test function.

```
def test(action_set, level_names):
"""Test."""

for level_name in level_names:
print(level_name)

level_returns = {level_name: [] for level_name in level_names}
with tf.Graph().as_default() as graph:
agent = Agent(len(action_set))
outputs = {}
for level_name in level_names:
env = create_environment(level_name, seed=1, is_test=True)
outputs[level_name] = build_actor(agent, env, level_name, action_set)

# for op in graph.get_operations():
# print(op.name)

with tf.train.SingularMonitoredSession(
checkpoint_dir=FLAGS.logdir,
hooks=[py_process.PyProcessHook()]) as session:

frozen_graph = tf.graph_util.convert_variables_to_constants(
session,
tf.get_default_graph().as_graph_def(),
['concat/(concat)'])
```

Running this gives:
`AssertionError: concat/(concat) is not in graph`

I have tried with other output nodes but it gives me the same result.

Any help on guiding me to what should be the output nodes for this, would be highly appreciated. Also please let me know if this approach is okay. Thank you.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.