tf.is_tensor

View source on GitHub

Checks whether x is a tensor or "tensor-like".

If is_tensor(x) returns True, it is safe to assume that x is a tensor or can be converted to a tensor using ops.convert_to_tensor(x).

Args
x A python object to check.
Returns
True if x is a tensor or "tensor-like", False if not.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/is_tensor