W3cubDocs

/TensorFlow

tf.errors.OperatorNotAllowedInGraphError

Raised when an unsupported operator is present in Graph execution.

For example, using a tf.Tensor as a Python bool inside a Graph will raise OperatorNotAllowedInGraphError. Iterating over values inside a tf.Tensor is also not supported in Graph execution.

Example:

@tf.function
def iterate_over(t):
  a,b,c = t
  return a

iterate_over(tf.constant([1, 2, 3]))
Traceback (most recent call last):

OperatorNotAllowedInGraphError: ...

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/errors/OperatorNotAllowedInGraphError