Skip to content

Using classes with predict_signature_def #450

@viksit

Description

@viksit

When using classes in the following,

# class_list = ["a", "B", ...]
class_tensor = tf.constant(class_list)
indices = tf.constant(list(range(0,len(class_list))))
table = tf.contrib.lookup.index_to_string_table_from_tensor(class_tensor)
classes = table.lookup(tf.to_int64(indices))

signature = predict_signature_def(inputs={"input": inputs},
                                  outputs={
                                  "scores": outputs,
                                  "classes": classes})

I get the following error,

{
  "error": "Prediction failed during encoding instances"
}

Without the classes key though, I get the output back just fine. What could be causing this? All examples in the repo seem to use signature_def_utils.build_signature_def() vs just predict_signature_def, so I'm not sure what could be going wrong here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions