tf.keras.KerasTensor | TensorFlow v2.16.1 (original) (raw)
tf.keras.KerasTensor
Stay organized with collections Save and categorize content based on your preferences.
Symbolic tensor -- encapsulates a shape and a dtype.
View aliases
Compat aliases for migration
SeeMigration guide for more details.
tf.compat.v1.keras.KerasTensor
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.Functionobjects 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".
| Attributes | | | ---------- | | | ndim | |
Methods
reshape
reshape(
newshape
)
squeeze
squeeze(
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
)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-06-07 UTC.