TensorSpec
Defined in tensorflow/python/framework/tensor_spec.py.
Describes a tf.Tensor.
A TensorSpec allows an API to describe the Tensors that it accepts or returns, before that Tensor exists. This allows dynamic and flexible graph construction and configuration.
dtypeReturns the dtype of elements in the tensor.
is_continuousWhether spec is continuous.
is_discreteWhether spec is discrete.
nameReturns the name of the described tensor.
shapeReturns the TensorShape that represents the shape of the tensor.
__init____init__(
shape,
dtype,
name=None
)
Creates a TensorSpec.
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.TypeError: If shape is not convertible to a tf.TensorShape, or dtype is not convertible to a tf.DType.__eq____eq__(other)
Return self==value.
__ne____ne__(other)
Return self!=value.
__reduce____reduce__()
helper for pickle
from_spec@classmethod
from_spec(
cls,
spec,
name=None
)
from_tensor@classmethod
from_tensor(
cls,
tensor,
name=None
)
is_bounded@classmethod is_bounded(cls)
is_compatible_withis_compatible_with(spec_or_tensor)
True if the shape and dtype of spec_or_tensor are compatible.
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/framework/TensorSpec