#[repr(i32)]
pub enum FullTypeId {
Show 28 variants TftUnset, TftVar, TftAny, TftProduct, TftNamed, TftCallable, TftTensor, TftArray, TftOptional, TftLiteral, TftDataset, TftMutexLock, TftBool, TftUint8, TftUint16, TftUint32, TftUint64, TftInt8, TftInt16, TftInt32, TftInt64, TftHalf, TftFloat, TftDouble, TftBfloat16, TftComplex64, TftComplex128, TftString,
}
Expand description

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 potentially different 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”.

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.

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_ARRAY[].

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

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[].

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.

Implementations

Returns true if value is a variant of FullTypeId.

Converts an i32 to a FullTypeId, or None if value is not a valid variant.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.