tf.TensorSpec
Stay organized with collections
Save and categorize content based on your preferences.
Describes a tf.Tensor.
View aliases
Main aliases
`tf.contrib.eager.TensorSpec`, `tf.contrib.framework.TensorSpec`
Compat aliases for migration
See
Migration guide for
more details.
tf.compat.v1.TensorSpec
, `tf.compat.v2.TensorSpec`
tf.TensorSpec(
shape, dtype=tf.dtypes.float32, name=None
)
Metadata for describing the tf.Tensor
objects accepted or returned
by some TensorFlow APIs.
Args |
shape
|
Value convertible to tf.TensorShape . The shape of the tensor.
|
dtype
|
Value convertible to tf.DType . The type of the tensor values.
|
name
|
Optional name for the Tensor.
|
Attributes |
dtype
|
Returns the dtype of elements in the tensor.
|
name
|
Returns the (optionally provided) name of the described tensor.
|
shape
|
Returns the TensorShape that represents the shape of the tensor.
|
value_type
|
|
Methods
from_spec
View source
@classmethod
from_spec(
spec, name=None
)
from_tensor
View source
@classmethod
from_tensor(
tensor, name=None
)
is_compatible_with
View source
is_compatible_with(
spec_or_tensor
)
Returns True if spec_or_tensor is compatible with this TensorSpec.
Two tensors are considered compatible if they have the same dtype
and their shapes are compatible (see tf.TensorShape.is_compatible_with
).
Args |
spec_or_tensor
|
A tf.TensorSpec or a tf.Tensor
|
Returns |
True if spec_or_tensor is compatible with self.
|
most_specific_compatible_type
View source
most_specific_compatible_type(
other
)
Returns the most specific TypeSpec compatible with self
and other
.
Raises |
ValueError
|
If there is no TypeSpec that is compatible with both self
and other .
|
__eq__
View source
__eq__(
other
)
Return self==value.
__ne__
View source
__ne__(
other
)
Return self!=value.
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.
Last updated 2020-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-01 UTC."],[],[]]