Keras 3 API documentation / Utilities / Tensor utilities

Tensor utilities

[source]

get_source_inputs function

keras.utils.get_source_inputs(tensor)

Returns the list of input tensors necessary to compute tensor.

Output will always be a list of tensors (potentially with 1 element).

Arguments

  • tensor: The tensor to start from.

Returns

List of input tensors.


[source]

is_keras_tensor function

keras.utils.is_keras_tensor(x)

Returns whether x is a Keras tensor.

A "Keras tensor" is a symbolic tensor, such as a tensor that was created via Input(). A "symbolic tensor" can be understood as a placeholder – it does not contain any actual numerical data, only a shape and dtype. It can be used for building Functional models, but it cannot be used in actual computations.