Skip to content

Python functions must return zero or more Tensors or ExtensionTypes or None values #367

@khatchad

Description

@khatchad
FAILED tests/keras/test_factorized_top_k.py::TestFactorizedTopK::test_factorized_topk_metrics0 - TypeError: To be compatible with tf.function, Python functions must return zero or more Tensors or ExtensionTypes or None values; in compilation of <function FactorizedTopK.update_state at 0x7508542b2830>, found return value of type Operation, which is not a Tensor or ExtensionType.

https://www.tensorflow.org/guide/extension_type

  • tf.function has certain restrictions on what types of values Python functions can return.
  • tf.function decorated functions can only return:
    • Zero or more Tensor objects (the core data structure in TensorFlow).
    • Zero or more ExtensionType objects (certain custom TensorFlow types).
    • None.

https://g.co/gemini/share/69dac2e125e9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpreconditionsRefactoring preconditions need to be added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions