W3cubDocs

/TensorFlow 2.4

tf.types.experimental.TensorLike

This symbol is a type alias.

Union of all types that can be converted to a tf.Tensor by tf.convert_to_tensor.

Source:

This definition may be used in user code. Additional types may be added in the future as more input types are supported.

Example:

def foo(x: TensorLike):
  pass

This definition passes static type verification for:

foo(tf.constant([1, 2, 3]))
foo([1, 2, 3])
foo(np.array([1, 2, 3]))

© 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/r2.4/api_docs/python/tf/types/experimental/TensorLike