Class InferContext::Input

Nested Relationships

This class is a nested type of Class InferContext.

Class Documentation

class Input

An input to the model.

Public Functions

virtual ~Input()

Destroy the input.

virtual const std::string &Name() const = 0

Return
The name of the input.

virtual size_t ByteSize() const = 0

Return
The size in bytes of this input. This is the size for one instance of the input, not the entire size of a batched input.

virtual DataType DType() const = 0

Return
The data-type of the input.

virtual ModelInput::Format Format() const = 0

Return
The format of the input.

virtual const DimsList &Dims() const = 0

Return
The dimensions/shape of the input.

virtual Error Reset() = 0

Prepare this input to receive new tensor values.

Forget any existing values that were set by previous calls to SetRaw().

Return
Error object indicating success or failure.

virtual Error SetRaw(const uint8_t *input, size_t input_byte_size) = 0

Set tensor values for this input from a byte array.

The array is not copied and so it must not be modified or destroyed until this input is no longer needed (that is until the Run() call(s) that use the input have completed). For batched inputs this function must be called batch-size times to provide all tensor values for a batch of this input.

Return
Error object indicating success or failure.
Parameters
  • input: The pointer to the array holding the tensor value.
  • input_byte_size: The size of the array in bytes, must match the size expected by the input.

virtual Error SetRaw(const std::vector<uint8_t> &input) = 0

Set tensor values for this input from a byte vector.

The vector is not copied and so it must not be modified or destroyed until this input is no longer needed (that is until the Run() call(s) that use the input have completed). For batched inputs this function must be called batch-size times to provide all tensor values for a batch of this input.

Return
Error object indicating success or failure.
Parameters
  • input: The vector holding tensor values.