Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to freeze the test / inference graph? #24

Open
purn3ndu opened this issue Sep 27, 2018 · 0 comments
Open

How to freeze the test / inference graph? #24

purn3ndu opened this issue Sep 27, 2018 · 0 comments

Comments

@purn3ndu
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant