llvm::TensorSpec

Specification of a named tensor: shape, element type, name, and port.

Synopsis

Declared in <llvm/Analysis/TensorSpec.h>

class TensorSpec final

Description

TensorSpec encapsulates the specification of a tensor: its dimensions, or "shape" (row-major), its type (see TensorSpec::getDataType specializations for supported types), its name and port (see "TensorFlow: Large-Scale Machine Learning on Heterogeneous Distributed Systems", section 4.2, para 2: https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/45166.pdf)

Note that the design is motivated by Tensorflow, but it is not intended to be Tensorflow-specific.

Member Functions

NameDescription
TensorSpec [constructor]Construct a TensorSpec that copies Other but uses NewName.
getElementByteSize Get the size, in bytes, of one element.
getElementCount Get the number of elements in a tensor with this shape.
getTotalTensorBufferSize Get the total size of a memory buffer needed to store the whole tensor.
isElementType Return true if the element type is T.
name Return the tensor name.
port Return the tensor port index.
shape Return the tensor dimensions in row-major order.
toJSON Write this specification as a JSON object to OS.
type Return the element type of the tensor.
operator== Return true if this specification equals Other.
operator!= Return true if this specification differs from Other.

Static Member Functions

NameDescription
createSpec Create a TensorSpec for element type T with the given name and shape.

Non-Member Functions

NameDescription
getTensorSpecFromJSONConstruct a TensorSpec from a JSON dictionary describing the tensor.