Represents a constant reference to an array (0 or more elements
consecutively in memory), i.e. a start pointer and a length. It allows
various APIs to take consecutive elements easily and conveniently.
Loads from a data source.
EventTracer is a class that users can inherit and implement to
log/serialize/stream etc. the profiling and debugging events that are
generated at runtime for a model. An example of this is the ETDump
implementation in the SDK codebase that serializes these events to a
flatbuffer.
A read-only buffer than can be freed.
A group of buffers that can be used to represent a device’s memory hierarchy.
A class that does simple allocation based on a size and returns the pointer
to the memory address. It bookmarks a buffer with certain size. The
allocation is simply checking space and growing the cur_ pointer with each
allocation request.
A container class for allocators used during Method load and execution.
An executable method of an executorch program. Maps to a python method like
forward() on the original nn.Module.
Describes a a method in an ExecuTorch program.
A facade class for loading programs and executing methods within them.
A deserialized ExecuTorch program binary.
Result type wrapping either a value of type T or an error.
Represent a reference to an array (0 or more elements
consecutively in memory), i.e. a start pointer and a length. It allows
various APIs to take consecutive elements easily and conveniently.
A minimal Tensor type whose API is a source compatible subset of at::Tensor.
Manages the storage behind an ETensor (torch::executor::Tensor).
Metadata about a specific tensor of an ExecuTorch Program.
Leaner optional class, subset of c10, std, and boost optional APIs.
Get the tag of the specified input.
Get metadata about the specified input.
Get the size in bytes of the specified memory-planned buffer.
Get the name of this method.
Get the number of inputs to this method.
Get the number of memory-planned buffers this method requires.
Get the number of outputs to this method.
Get the tag of the specified output.
Get metadata about the specified output.
Execute the method.
Resets execution state to the start of the Method. For use with the
experimental_step() API.
Advances/executes a single instruction in the method.
DEPRECATED: Use MethodMeta instead to access metadata, and set_input to
update Method inputs.
Copies the method’s inputs into the provided array.
Retrieves the output at the specified index.
Copies the method’s outputs into the provided array.
Returns the number of inputs the Method expects.
Returns the MethodMeta that corresponds to the calling Method.
DEPRECATED: Use MethodMeta instead to access metadata, and set_input to
update Method inputs.
DEPRECATED: Use MethodMeta instead to access metadata, and get_output to
retrieve Method outputs.
Returns the number of outputs the Method returns.
Sets the internal input value to be equivalent to the to the provided
value.
Sets the values of all method inputs.
Sets the data buffer of the specified method output to the provided value.
Constructs an instance with the provided data loader and memory allocator.
Checks if the program is loaded.
Loads the program using the specified data loader and memory allocator.
Get a list of method names available in the loaded program.
Loads the program and method if needed.
Looks for an ExecuTorch program header in the provided data.
Get the constant buffer inside Program with index buffer_idx.
@param[in] buffer_idx the index of the buffer in the constant_buffer.
@param[in] nbytes the number of bytes to read from the buffer.
@return The buffer with corresponding index.
Returns the name of the method at particular index.
DEPRECATED: Use MethodMeta instead.
DEPRECATED: Get the pytree encoding string for the output. Deprecated as
this functionality will eventually move out of the core program into a
higher level structure, but that does not exist at this time.
@param[in] method_name The name of the method to get the encoding for.
Loads a Program from the provided loader. The Program will hold a pointer
to the loader, which must outlive the returned Program instance.
Loads the named method and prepares it for execution.
Gathers metadata for the named method.
Returns the number of methods in the program.
DEPRECATED: Use MethodMeta instead.
@param type The type of the data (int, float, bool).
@param dim Number of dimensions, and the length of the sizes array.
@param sizes Sizes of the tensor at each dimension. Must contain dim
entries.
@param data Pointer to the data, whose size is determined by type,
dim, and sizes. The tensor will not own this memory.
@param dim_order Order in which dimensions are laid out in memory.
@param strides Strides of the tensor at each dimension. Must contain dim
entries.
@param dynamism The mutability of the shape of the tensor.
Returns the size in bytes of one element of the tensor.
Returns the size of the tensor in bytes.
Returns the dim order of the tensor.
Returns the size of the tensor in bytes.
Returns the scalar type of the input/output.
Returns the sizes of the tensor.