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 handle multi tensors input? #9

Closed
doubler opened this issue Mar 3, 2016 · 6 comments
Closed

How to handle multi tensors input? #9

doubler opened this issue Mar 3, 2016 · 6 comments

Comments

@doubler
Copy link

doubler commented Mar 3, 2016

The mnist example shows how to use the model with one input tensor x and one output tensor y.
While I have two input, tensor x and a tf.placeholder named dropout_prob.
If I don't specify the dropout_prob value, it will produce error output log like

W external/tf/tensorflow/core/common_runtime/executor.cc:1157] 0x7fcf1c0023c0 Compute status: Invalid argument: You must feed a value for placeholder tensor 'dropout_prob' with dtype float
     [[Node: dropout_prob = Placeholder[dtype=DT_FLOAT, shape=[], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

Would you please show some example with multi input tensors or multi output tensors?

@doubler
Copy link
Author

doubler commented Mar 3, 2016

I have solved my problem by pre-define dropout_prob as a tf.constant before export the model.
While I'm still looking forward the multi input and output example. :)

@fangweili
Copy link
Contributor

Unfortunately, neither our standard ClassificationSignature nor RegressionSignature supports multiple input binding for now. You can however, use GenericSignature to specify arbitrary number of inputs and outputs.

You can use exporter.generic_signature() to create it. Then provide it as default_signature in exporter.export().

@doubler
Copy link
Author

doubler commented Mar 25, 2016

Got it. Thanks for explanation.

@doubler doubler closed this as completed Mar 25, 2016
@insectatorious
Copy link

@doubler would it be possible for you to share a code example of how you set the dropout_prob using tf.constant? I'm confused about how to fit this into the export step.

@doubler
Copy link
Author

doubler commented Jul 25, 2017

@insectatorious no need to set the dropout_prob, just feed it with 1.0 as input when serving online

@fabienbaradel
Copy link

@doubler I don't understand your explanation. What do you mean by "feed it with 1.0 as input"?

Below is the inception signature for a standard image classification:

      classification_signature = (
          tf.saved_model.signature_def_utils.build_signature_def(
              inputs={
                  tf.saved_model.signature_constants.CLASSIFY_INPUTS:
                      classify_inputs_tensor_info
              },
              outputs={
                  tf.saved_model.signature_constants.CLASSIFY_OUTPUT_CLASSES:
                      classes_output_tensor_info,
                  tf.saved_model.signature_constants.CLASSIFY_OUTPUT_SCORES:
                      scores_output_tensor_info
              },
              method_name=tf.saved_model.signature_constants.
              CLASSIFY_METHOD_NAME))

Could you show how is yours with two inputs? Do you have to redefine the tf.saved_mode.signature_constants?

Thanks for help.

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

4 participants