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

Fix scalar and no-rank/no-shape tensor validation when using the TensorFlow predictor #1310

Closed
RobertLucian opened this issue Aug 27, 2020 · 0 comments · Fixed by #1311
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@RobertLucian
Copy link
Member

RobertLucian commented Aug 27, 2020

Description

2 properties of a tensor (in TensorFlow) are the rank and shape. Right now, when using the TensorFlow predictor, only the 2 following kinds of tensors are supported:

  • Tensors with known rank and shape. Such as (3, 224, 224).
  • Tensors with known rank and unknown shape. Such as (3, -1, -1).

Reproduce

When tensors have the following properties, the validation will fail, when in reality, it shouldn't:

  • Tensors with no rank and empty shape - for scalars. Such as ().
  • Tensors with unknown rank and shape. Such as (-1, -1, -1, ...).

When an input tensor has the above properties, the following error pops up the logs cortex logs <api-name>.

Traceback (most recent call last):
File "/src/cortex/serve/serve.py", line 282, in start_fn
tf_serving_host=tf_serving_host, tf_serving_port=tf_serving_port
File "/src/cortex/lib/type/predictor.py", line 72, in initialize_client
client = TensorFlowClient(tf_serving_address, self.models)
File "/src/cortex/lib/client/tensorflow.py", line 48, in init
self._signatures, get_model_signature_map(models)
File "/src/cortex/lib/client/tensorflow.py", line 186, in extract_signatures
signature_defs[model_name], signature_keys[model_name], model_name,
File "/src/cortex/lib/client/tensorflow.py", line 246, in extract_signature
"shape": [int(dim["size"]) for dim in input_metadata["tensorShape"]["dim"]],
KeyError: 'dim'

Additional

References that show that no-rank/no-shape and scalar tensors do indeed exist and are used:

@RobertLucian RobertLucian added the enhancement New feature or request label Aug 27, 2020
@RobertLucian RobertLucian self-assigned this Aug 27, 2020
@RobertLucian RobertLucian changed the title Support scalar and no-rank/no-shape tensors when using the TensorFlow predictor Fix scalar and no-rank/no-shape tensor validation when using the TensorFlow predictor Aug 27, 2020
@RobertLucian RobertLucian added bug Something isn't working and removed enhancement New feature or request labels Aug 27, 2020
@deliahu deliahu added the v0.20 label Aug 27, 2020
@deliahu deliahu added this to the v0.20 milestone Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants