tf.keras.KerasTensor

Symbolic tensor -- encapsulates a shape and a dtype.

You can use KerasTensor instances to build computation graphs of Keras operations, such as keras.Function objects or Functional keras.models.Model objects.

Example:

x = keras.KerasTensor(shape=(3, 4), dtype="float32")
x.shape
(3, 4)
x.dtype
float32

Calling a Keras operation (including a layer or a model) on a KerasTensor instance will return another KerasTensor instance with the appropriate shape and dtype. This is called a "symbolic call" (since there is no actual data involved). The computation of the correct output shape and dtype is called "static shape inference".

ndim

Methods

reshape

View source

squeeze

View source

__abs__

View source

__add__

View source

__and__

View source

__array__

View source

__bool__

View source

__div__

View source

__floordiv__

View source

__ge__

View source

Return self>=value.

__getitem__

View source

__gt__

View source

Return self>value.

__invert__

View source

__iter__

View source

__le__

View source

Return self<=value.

__lt__

View source

Return self<value.

__matmul__

View source

__mod__

View source

__mul__

View source

__ne__

View source

Return self!=value.

__neg__

View source

__or__

View source

__pow__

View source

__radd__

View source

__rand__

View source

__rdiv__

View source

__rfloordiv__

View source

__rmatmul__

View source

__rmod__

View source

__rmul__

View source

__ror__

View source

__rpow__

View source

__rsub__

View source

__rtruediv__

View source

__rxor__

View source

__sub__

View source

__truediv__

View source

__xor__

View source