Enum tfrecord::protobuf::FullTypeId
source · #[repr(i32)]pub enum FullTypeId {
Show 34 variants
TftUnset,
TftVar,
TftAny,
TftProduct,
TftNamed,
TftForEach,
TftCallable,
TftTensor,
TftArray,
TftOptional,
TftLiteral,
TftEncoded,
TftShapeTensor,
TftBool,
TftUint8,
TftUint16,
TftUint32,
TftUint64,
TftInt8,
TftInt16,
TftInt32,
TftInt64,
TftHalf,
TftFloat,
TftDouble,
TftBfloat16,
TftComplex64,
TftComplex128,
TftString,
TftDataset,
TftRagged,
TftIterator,
TftMutexLock,
TftLegacyVariant,
}
Expand description
LINT.IfChange Experimental. Represents the complete type information of a TensorFlow value.
Variants§
TftUnset
The default represents an uninitialized values.
TftVar
Type variables may serve as placeholder for any other type ID in type templates.
Examples: TFT_DATASET[TFT_VAR[“T”]] is a Dataset returning a type indicated by “T”. TFT_TENSOR[TFT_VAR[“T”]] is a Tensor of n element type indicated by “T”. TFT_TENSOR[TFT_VAR[“T”]], TFT_TENSOR[TFT_VAR[“T”]] are two tensors of identical element types. TFT_TENSOR[TFT_VAR[“P”]], TFT_TENSOR[TFT_VAR[“Q”]] are two tensors of independent element types.
TftAny
Wildcard type. Describes a parameter of unknown type. In TensorFlow, that can mean either a “Top” type (accepts any type), or a dynamically typed object whose type is unknown in context. Important: “unknown” does not necessarily mean undeterminable!
TftProduct
The algebraic product type. This is an algebraic type that may be used just for logical grouping. Not to confused with TFT_TUPLE which describes a concrete object of several elements.
Example: TFT_DATASET[TFT_PRODUCT[TFT_TENSOR[TFT_INT32], TFT_TENSOR[TFT_FLOAT64]]] is a Dataset producing two tensors, an integer one and a float one.
TftNamed
Represents a named field, with the name stored in the attribute.
Parametrization:
TFT_NAMED[
is the type of the field is the field name, as string (thpugh can theoretically be an int as well)
Example: TFT_RECORD[ TFT_NAMED[TFT_TENSOR[TFT_INT32]]{‘foo’}, TFT_NAMED[TFT_TENSOR[TFT_FLOAT32]]{‘bar’}, ] is a structure with two fields, an int tensor “foo” and a float tensor “bar”.
TftForEach
Template definition. Expands the variables by repeating a template as arguments of container.
Parametrization:
TFT_FOR_EACH[<container_type>, ,
- <container_type> is the type of the container that the template will be expanded into
- is any type definition that potentially contains type variables
is a TFT_VAR and may include more types in the future
Example: TFT_FOR_EACH[ TFT_PRODUCT, TFT_TENSOR[TFT_VAR[“t”]], TFT_VAR[“t”] ] will substitute a T = TFT_INT32 to TFT_PRODUCT[TFT_TENSOR[TFT_INT32]] and a T = (TFT_INT32, TFT_INT64) to TFT_PRODUCT[TFT_TENSOR[TFT_INT32], TFT_TENSOR[TFT_INT64]].
TftCallable
Callable types describe functions and ops.
Parametrization:
TFT_CALLABLE[
is the type of the arguments; TFT_PRODUCT represents multiple arguments. is the return type; TFT_PRODUCT represents multiple return values (that means that callables returning multiple things don’t necessarily return a single tuple).
Example: TFT_CALLABLE[ TFT_ANY, TFT_PRODUCT[TFT_TENSOR[TFT_INT32], TFT_TENSOR[TFT_FLOAT64]], ] is a callable with unspecified (for now) input arguments, and two return values of type tensor.
TftTensor
The usual Tensor. This is a parametric type.
Parametrization:
TFT_TENSOR[
is currently limited to one of the element types defined below. is not yet defined, and may only be TFT_UNKNOWN for now.
A TFT_SHAPE type will be defined in the future.
Example: TFT_TENSOR[TFT_INT32, TFT_UNKNOWN] is a Tensor of int32 element type and unknown shape.
TODO(mdan): Define TFT_SHAPE and add more examples.
TftArray
Array (or tensorflow::TensorList in the variant type registry).
Note: this is not to be confused with the deprecated TensorArray*
ops
which are not supported by FullType.
This type represents a random-access list whose elements can be
described by a single type. Although immutable, Array is expected to
support efficient mutation semantics (i.e. element update) in the
user-facing API.
The element type may be generic or even TFT_ANY for a heterogenous list.
Parametrization:
TFT_ARRAY[
may be any concrete type.
Examples: TFT_ARRAY[TFT_TENSOR[TFT_INT32]] is a TensorArray holding int32 Tensors of any shape. TFT_ARRAY[TFT_TENSOR[TFT_UNKNOWN]] is a TensorArray holding Tensors of mixed element types. TFT_ARRAY[TFT_UNKNOWN] is a TensorArray holding any element type. TFT_ARRAY[] is equivalent to TFT_ARRAY[TFT_UNKNOWN]. TFT_ARRAY[TFT_ARRAY[]] is an array or arrays (of unknown types).
TftOptional
Optional (or tensorflow::OptionalVariant in the variant type registry). This type represents a value that may either hold an element of a single specified type, or nothing at all.
Parametrization:
TFT_OPTIONAL[
may be any concrete type.
Examples: TFT_OPTIONAL[TFT_TENSOR[TFT_INT32]] is an Optional holding an int32 Tensor of any shape.
TftLiteral
Literal types describe compile-time constant values. Literal types may also participate in dependent types.
Parametrization:
TFT_LITERAL[
may be any concrete type compatible that can hold is the type’s attribute, and holds the actual literal value
Examples: TFT_LITERAL[TFT_INT32]{1} is the compile-time constant 1.
TftEncoded
Encoding types describe a value of a certain type, encoded as a different type.
Parametrization:
TFT_ENCODED[
may be any type may be any type
Examples: TFT_ENCODING[TFT_INT32, TFT_STRING] is an integer encoded as string.
TftShapeTensor
The type of “shape tensors” where the runtime value is the shape of some tensor(s), i.e. the output of tf.shape. Shape tensors have special, host-only placement, in contrast to TFT_TENSOR[TFT_INT32] which is the type of a normal numeric tensor with no special placement.
Examples: TFT_SHAPE_TENSOR[TFT_INT32] is the most common TFT_SHAPE_TENSOR[TFT_INT64] is also allowed
TftBool
The bool element type. TODO(mdan): Quantized types, legacy representations (e.g. ref)
TftUint8
Integer element types.
TftUint16
TftUint32
TftUint64
TftInt8
TftInt16
TftInt32
TftInt64
TftHalf
Floating-point element types.
TftFloat
TftDouble
TftBfloat16
TftComplex64
Complex element types. TODO(mdan): Represent as TFT_COMPLEX[TFT_DOUBLE] instead?
TftComplex128
TftString
The string element type.
TftDataset
Datasets created by tf.data ops and APIs. Datasets have generator/iterable semantics, that is, one can construct an iterator from them. Like Array, they are considered to return elements that can be described by a single type. Unlike Array, they do not support random access or mutation, and can potentially produce an infinite number of elements. A datasets can produce logical structures (e.g. multiple elements). This is expressed using TFT_PRODUCT.
Parametrization: TFT_DATASET[
may be a concrete type or a type symbol. It represents the data type of the elements produced by the dataset.
Examples: TFT_DATSET[TFT_TENSOR[TFT_INT32]] is a Dataset producing single int32 Tensors of unknown shape. TFT_DATSET[TFT_PRODUCT[TFT_TENSOR[TFT_INT32], TFT_TENSOR[TFT_FLOAT32]] is a Dataset producing pairs of Tensors, one integer and one float. Note: The high ID number is to prepare for the eventuality that Datasets will be supported by user types in the future.
TftRagged
A ragged tensor created by tf.ragged ops and APIs.
Parametrization: TFT_RAGGED[<element_type>].
TftIterator
Iterators created by tf.data ops and APIs. Very similar to Datasets, except they are mutable.
Parametrization: TFT_ITERATOR[
may be a concrete type or a type symbol. It represents the data type of the elements produced by the dataset.
TftMutexLock
A mutex lock tensor, produced by tf.raw_ops.MutexLock. Unlike strict execution models, where ownership of a lock is denoted by “running after the lock has been acquired”, in non-strict mode, lock ownership is in the true sense: “the op argument representing the lock is available”. Mutex locks are the dynamic counterpart of control dependencies. TODO(mdan): Properly document this thing.
Parametrization: TFT_MUTEX_LOCK[].
TftLegacyVariant
The equivalent of a Tensor with DT_VARIANT dtype, kept here to simplify translation. This type should not normally appear after type inference. Note that LEGACY_VARIANT != ANY: TENSOR[INT32] is a subtype of ANY, but is not a subtype of LEGACY_VARIANT.
Implementations§
source§impl FullTypeId
impl FullTypeId
source§impl FullTypeId
impl FullTypeId
sourcepub fn as_str_name(&self) -> &'static str
pub fn as_str_name(&self) -> &'static str
String value of the enum field names used in the ProtoBuf definition.
The values are not transformed in any way and thus are considered stable (if the ProtoBuf definition does not change) and safe for programmatic use.
sourcepub fn from_str_name(value: &str) -> Option<Self>
pub fn from_str_name(value: &str) -> Option<Self>
Creates an enum from field names used in the ProtoBuf definition.
Trait Implementations§
source§impl Clone for FullTypeId
impl Clone for FullTypeId
source§fn clone(&self) -> FullTypeId
fn clone(&self) -> FullTypeId
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FullTypeId
impl Debug for FullTypeId
source§impl Default for FullTypeId
impl Default for FullTypeId
source§fn default() -> FullTypeId
fn default() -> FullTypeId
source§impl<'de> Deserialize<'de> for FullTypeId
impl<'de> Deserialize<'de> for FullTypeId
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl From<FullTypeId> for i32
impl From<FullTypeId> for i32
source§fn from(value: FullTypeId) -> i32
fn from(value: FullTypeId) -> i32
source§impl Hash for FullTypeId
impl Hash for FullTypeId
source§impl Ord for FullTypeId
impl Ord for FullTypeId
source§fn cmp(&self, other: &FullTypeId) -> Ordering
fn cmp(&self, other: &FullTypeId) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<FullTypeId> for FullTypeId
impl PartialEq<FullTypeId> for FullTypeId
source§fn eq(&self, other: &FullTypeId) -> bool
fn eq(&self, other: &FullTypeId) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<FullTypeId> for FullTypeId
impl PartialOrd<FullTypeId> for FullTypeId
source§fn partial_cmp(&self, other: &FullTypeId) -> Option<Ordering>
fn partial_cmp(&self, other: &FullTypeId) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for FullTypeId
impl Serialize for FullTypeId
source§impl TryFrom<i32> for FullTypeId
impl TryFrom<i32> for FullTypeId
§type Error = DecodeError
type Error = DecodeError
source§fn try_from(value: i32) -> Result<FullTypeId, DecodeError>
fn try_from(value: i32) -> Result<FullTypeId, DecodeError>
impl Copy for FullTypeId
impl Eq for FullTypeId
impl StructuralEq for FullTypeId
impl StructuralPartialEq for FullTypeId
Auto Trait Implementations§
impl RefUnwindSafe for FullTypeId
impl Send for FullTypeId
impl Sync for FullTypeId
impl Unpin for FullTypeId
impl UnwindSafe for FullTypeId
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere R: Read + ReadEndian<P>, P: Default,
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.