Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

how to restore a meta graph with custom ops for inference in tensorflow #107

Open
karterotte opened this issue Oct 13, 2021 · 0 comments
Open

Comments

@karterotte
Copy link

I used a custom op for data transform and got a saved model.
All above is ok
Now I want to load this model and do some predict.
Code likes (ps_pull):

with tf.Session(config=config) as sess:
          # init
          self.do_prepare_data()
          
          # load pb
          meta_graph_def = tf.saved_model.loader.load(
              sess, ["serve"], model_path)
          signature = meta_graph_def.signature_def
          ...
          # load ps   this is my custom op 
          ps_pull = tf.load_op_library('/usr/local/src/ps_lite.so')
          sess.run(ps_pull)
          
          # load data 
          train_input, sample_id, _ = dataset_to_input(self.train_data)
         
          # here the data contains custom op
          sess.run(train_input)

But the data is not correct.It seems the custom op didn't work and return init values.

How do I fix it? Tanks

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

No branches or pull requests

1 participant