ModelVariantHandle Class Reference#
|
Runtime Library v0.30
Mobilint SDK qb
|
Handle to a specific variant of a loaded model. More...
#include <model_variant_handle.h>
Public Member Functions | |
| ModelVariantHandle (const ModelVariantHandle &other)=delete | |
| ModelVariantHandle (ModelVariantHandle &&other)=delete | |
| ModelVariantHandle & | operator= (const ModelVariantHandle &rhs)=delete |
| ModelVariantHandle & | operator= (ModelVariantHandle &&rhs) noexcept=delete |
| int | getVariantIdx () const |
| Returns the index of this model variant. | |
| const std::vector< std::vector< int64_t > > & | getModelInputShape () const |
| Returns the input shape for this model variant. | |
| const std::vector< std::vector< int64_t > > & | getModelOutputShape () const |
| Returns the output shape for this model variant. | |
| const std::vector< BufferInfo > & | getInputBufferInfo () const |
| Returns the input buffer information for this variant. | |
| const std::vector< BufferInfo > & | getOutputBufferInfo () const |
| Returns the output buffer information for this variant. | |
| std::vector< Scale > | getInputScale () const |
| Returns the input quantization scale(s) for this variant. | |
| std::vector< Scale > | getOutputScale () const |
| Returns the output quantization scale(s) for this variant. | |
Buffer Management APIs | |
These APIs are used when performing inference with Model::inferBuffer or Model::inferBufferToFloat, using this variant’s input and output shapes. Buffers are acquired using:
Any acquired buffer must be released using:
Repositioning is handled by:
| |
| std::vector< Buffer > | acquireInputBuffer (const std::vector< std::vector< int > > &seqlens={}) const |
| std::vector< Buffer > | acquireOutputBuffer (const std::vector< std::vector< int > > &seqlens={}) const |
| std::vector< std::vector< Buffer > > | acquireInputBuffers (int batch_size, const std::vector< std::vector< int > > &seqlens={}) const |
| std::vector< std::vector< Buffer > > | acquireOutputBuffers (int batch_size, const std::vector< std::vector< int > > &seqlens={}) const |
| StatusCode | releaseBuffer (std::vector< Buffer > &buffer) const |
| StatusCode | releaseBuffers (std::vector< std::vector< Buffer > > &buffers) const |
| StatusCode | repositionInputs (const std::vector< float * > &input, std::vector< Buffer > &input_buf, const std::vector< std::vector< int > > &seqlens={}) const |
| StatusCode | repositionOutputs (const std::vector< Buffer > &output_buf, std::vector< float * > &output, const std::vector< std::vector< int > > &seqlens={}) const |
| StatusCode | repositionOutputs (const std::vector< Buffer > &output_buf, std::vector< std::vector< float > > &output, const std::vector< std::vector< int > > &seqlens={}) const |
| StatusCode | repositionInputs (const std::vector< float * > &input, std::vector< std::vector< Buffer > > &input_buf, const std::vector< std::vector< int > > &seqlens={}) const |
| StatusCode | repositionOutputs (const std::vector< std::vector< Buffer > > &output_buf, std::vector< float * > &output, const std::vector< std::vector< int > > &seqlens={}) const |
| StatusCode | repositionOutputs (const std::vector< std::vector< Buffer > > &output_buf, std::vector< std::vector< float > > &output, const std::vector< std::vector< int > > &seqlens={}) const |
Friends | |
| class | ModelImpl |
Detailed Description
Handle to a specific variant of a loaded model.
This class provides access to variant-specific information such as input/output shapes, buffer information, and quantization scales. It also offers APIs for managing inference buffers, consistent with the interface of the Model class.
Objects of this class are obtained via Model::getModelVariantHandle.
Definition at line 29 of file model_variant_handle.h.
Member Function Documentation
◆ getVariantIdx()
| int mobilint::ModelVariantHandle::getVariantIdx | ( | ) | const |
Returns the index of this model variant.
- Returns
- Index of the model variant.
◆ getModelInputShape()
| const std::vector< std::vector< int64_t > > & mobilint::ModelVariantHandle::getModelInputShape | ( | ) | const |
Returns the input shape for this model variant.
- Returns
- Reference to the input shape.
◆ getModelOutputShape()
| const std::vector< std::vector< int64_t > > & mobilint::ModelVariantHandle::getModelOutputShape | ( | ) | const |
Returns the output shape for this model variant.
- Returns
- Reference to the output shape.
◆ getInputBufferInfo()
| const std::vector< BufferInfo > & mobilint::ModelVariantHandle::getInputBufferInfo | ( | ) | const |
Returns the input buffer information for this variant.
- Returns
- Reference to a vector of input buffer information.
◆ getOutputBufferInfo()
| const std::vector< BufferInfo > & mobilint::ModelVariantHandle::getOutputBufferInfo | ( | ) | const |
Returns the output buffer information for this variant.
- Returns
- Reference to a vector of output buffer information.
◆ getInputScale()
| std::vector< Scale > mobilint::ModelVariantHandle::getInputScale | ( | ) | const |
Returns the input quantization scale(s) for this variant.
- Returns
- Vector of input scales.
◆ getOutputScale()
| std::vector< Scale > mobilint::ModelVariantHandle::getOutputScale | ( | ) | const |
Returns the output quantization scale(s) for this variant.
- Returns
- Vector of output scales.
Friends And Related Symbol Documentation
◆ ModelImpl
|
friend |
Definition at line 153 of file model_variant_handle.h.
The documentation for this class was generated from the following file:
Generated by