TransWikia.com

Operation composition in tensorflow-1.14,15

Data Science Asked by John Sig on June 27, 2021

I am trying to make do a very simple operation in tensorflow 1.15.
I have a pretrained network that I would like to use for inference.

This network exposes a tf.global_variable let’s say input and an output say output.
Now, having a session variable sess, if you want to do inference, you just run:

inference_output = sess.run(output, {input: input_numpy})

My problem is that I have already implemented a frontend to this inference (to calculate input) which is a set of tensorflow operations that I will call exp and which expects an input variable say args.

I can’t find a way so the value of exp is feeded to the global variable input and thus my graph becomes:

args -> (expr -> input) -> output

Right now I am doing this as:

preprocessing_inp = sess.run(expr, {args: args_numpy})
inference_output = sess.run(output, {input: preprocessing_inp})

but what I would like to have only one operation (so everything does a single gpu pass):

inference_output = sess.run(output, {args: args_numpy})

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP