Symbolic tensor -- encapsulates a shape and a dtype.
tf.keras.KerasTensor(
shape,
dtype='float32',
sparse=False,
record_history=True,
name=None
)
You can use KerasTensor instances to build computation graphs of Keras operations, such as keras.Function objects or Functional keras.models.Model objects.
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".
| Attributes | |
|---|---|
ndim | |
reshapereshape(
newshape
)
squeezesqueeze(
axis=None
)
__abs____abs__()
__add____add__(
other
)
__and____and__(
other
)
__array____array__()
__bool____bool__()
__div____div__(
other
)
__floordiv____floordiv__(
other
)
__ge____ge__(
other
)
Return self>=value.
__getitem____getitem__(
key
)
__gt____gt__(
other
)
Return self>value.
__invert____invert__()
__iter____iter__()
__le____le__(
other
)
Return self<=value.
__lt____lt__(
other
)
Return self<value.
__matmul____matmul__(
other
)
__mod____mod__(
other
)
__mul____mul__(
other
)
__ne____ne__(
other
)
Return self!=value.
__neg____neg__()
__or____or__(
other
)
__pow____pow__(
other
)
__radd____radd__(
other
)
__rand____rand__(
other
)
__rdiv____rdiv__(
other
)
__rfloordiv____rfloordiv__(
other
)
__rmatmul____rmatmul__(
other
)
__rmod____rmod__(
other
)
__rmul____rmul__(
other
)
__ror____ror__(
other
)
__rpow____rpow__(
other
)
__rsub____rsub__(
other
)
__rtruediv____rtruediv__(
other
)
__rxor____rxor__(
other
)
__sub____sub__(
other
)
__truediv____truediv__(
other
)
__xor____xor__(
other
)
© 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/keras/KerasTensor