question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tensorflow Serving returns "Tensor name: probability has no shape information"

See original GitHub issue

For given exported model:

MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:

signature_def['serving_default']:
  The given SavedModel SignatureDef contains the following input(s):
    inputs['input'] tensor_info:
        dtype: DT_STRING
        shape: unknown_rank
        name: input_image_as_bytes:0
  The given SavedModel SignatureDef contains the following output(s):
    outputs['output'] tensor_info:
        dtype: DT_STRING
        shape: unknown_rank
        name: prediction:0
    outputs['probability'] tensor_info:
        dtype: DT_DOUBLE
        shape: unknown_rank
        name: probability:0
  Method name is: tensorflow/serving/predict

Sending a following request to the serving REST API:

curl -X POST \
  http://localhost:9001/v1/models/testmodel:predict \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{
  "signature_name": "serving_default",
  "instances": [
     { "b64": "/9j/4AAk=" }
   ]
}'

returns an error:

{
    "error": "Tensor name: probability has no shape information "
}

is it something that needs to be adjusted in the export function in aocr?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

8reactions
MariusMezcommented, Nov 4, 2018

Hi,

Since months I’m stuck on the same problem using the curl command provided as exemple. But today I tried to understand why this error { "error": "Tensor name: probability has no shape information " } occur with the documentation here: https://www.tensorflow.org/serving/api_rest and I found an answer using this curl command instead:

curl -X POST --output - \
  http://yourserver:9001/v1/models/aocr:predict \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{
  "signature_name": "serving_default",
  "inputs": 
     {
     	"input": { "b64": "/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAOaADAAQAAAABAAAAHAAA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2j+8KpWcu7chRhhmIJHByc1fwP8igR/9DKhIwNtI1oHuPM3tsyG8vtkd6bExAFW0Y4rmRx3AwD5gR94hjz3FXLqMJcOP4gFB+oAH9KhjG48+lWLg7rxye8hqhNkSRhQqqoAAwKsKVHtxjIHvUP3nGalQYFMBwOCD/+qpd/1pgUcU/NAH//2Q==" }
     }
}'

Yeah! I’ve the correct output:

{
    "outputs": {
        "probability": 0.999405,
        "output": "TTXJHC"
    }
}

I dont’ know why we have to specify the input tensors in column format instead of using the row format.

Specifying input tensors in row format.

This format is similar to PredictRequest proto of gRPC API and the CMLE predict API. Use this format if all named input tensors have the same 0-th dimension. If they don’t, use the columnar format described later below.

"instances": [ { "b64": "/9j/4AAk==" } ] –> { "error": "Tensor name: probability has no shape information " }

Specifying input tensors in column format.

Use this format to specify your input tensors, if individual named inputs do not have the same 0-th dimension or you want a more compact representation. This format is similar to the inputs field of the gRPC Predict request.

"inputs": { "input": { "b64": "/9j/4AAk==" } } –> Working

3reactions
emedvedevcommented, Jun 16, 2018

Oh, that’s interesting. I’ll try to get to it during the weekend.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tensor name has no shape information ERROR when ...
I managed to fix this. I used tf.reshape on what i wanted to output and passed that into the signature builder.
Read more >
VAE with Tensorflow probability library. Problems ...
Hello, I am trying to replicate the approach to create a VAE as described here. However, I don't understand the following piece of...
Read more >
RESTful API | TFX - TensorFlow
If the output of the model contains only one named tensor, we omit the name and outputs key maps to a list of...
Read more >
tf.data.TFRecordDataset | TensorFlow v2.11.0
A scalar tf.int64 Tensor representing the cardinality of the dataset. If the cardinality is infinite or unknown, cardinality returns the named constants tf....
Read more >
A Tour of TensorFlow Probability
TensorFlow Probability Distributions have shape semantics -- we partition shapes into semantically distinct pieces, even though the same chunk of memory ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found