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 KerasTensorinstance 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

View source

reshape(
    newshape
)

squeeze

View source

squeeze(
    axis=None
)

__abs__

View source

__abs__()

__add__

View source

__add__(
    other
)

__and__

View source

__and__(
    other
)

__array__

View source

__array__()

__bool__

View source

__bool__()

__div__

View source

__div__(
    other
)

__floordiv__

View source

__floordiv__(
    other
)

__ge__

View source

__ge__(
    other
)

Return self>=value.

__getitem__

View source

__getitem__(
    key
)

__gt__

View source

__gt__(
    other
)

Return self>value.

__invert__

View source

__invert__()

__iter__

View source

__iter__()

__le__

View source

__le__(
    other
)

Return self<=value.

__lt__

View source

__lt__(
    other
)

Return self<value.

__matmul__

View source

__matmul__(
    other
)

__mod__

View source

__mod__(
    other
)

__mul__

View source

__mul__(
    other
)

__ne__

View source

__ne__(
    other
)

Return self!=value.

__neg__

View source

__neg__()

__or__

View source

__or__(
    other
)

__pow__

View source

__pow__(
    other
)

__radd__

View source

__radd__(
    other
)

__rand__

View source

__rand__(
    other
)

__rdiv__

View source

__rdiv__(
    other
)

__rfloordiv__

View source

__rfloordiv__(
    other
)

__rmatmul__

View source

__rmatmul__(
    other
)

__rmod__

View source

__rmod__(
    other
)

__rmul__

View source

__rmul__(
    other
)

__ror__

View source

__ror__(
    other
)

__rpow__

View source

__rpow__(
    other
)

__rsub__

View source

__rsub__(
    other
)

__rtruediv__

View source

__rtruediv__(
    other
)

__rxor__

View source

__rxor__(
    other
)

__sub__

View source

__sub__(
    other
)

__truediv__

View source

__truediv__(
    other
)

__xor__

View source

__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.