litert::
Model
#include <litert_model.h>
A C++ wrapper for LiteRtModel
, representing a LiteRT model.
Summary
\internal
Inheritance
Inherits from: internal::BaseHandle< LiteRtModel >Constructors and Destructors
Model
()
Public functions
FindSignature
(absl::string_view signature_key) const
Expected
< SimpleSignature >
SimpleSignature
object for the given signature key. GetInputTensorType
(size_t signature_index, size_t input_index) const
Expected
< RankedTensorType >
GetInputTensorType
(size_t signature_index, absl::string_view input_name) const
Expected
< RankedTensorType >
GetInputTensorType
(absl::string_view signature_key, absl::string_view input_name) const
Expected
< RankedTensorType >
GetInputTensorType
(absl::string_view input_name) const
Expected
< RankedTensorType >
GetNumSignatures
() const
size_t
GetOutputTensorType
(size_t signature_index, size_t output_index) const
Expected
< RankedTensorType >
GetOutputTensorType
(size_t signature_index, absl::string_view output_name) const
Expected
< RankedTensorType >
GetOutputTensorType
(absl::string_view signature_key, absl::string_view output_name) const
Expected
< RankedTensorType >
GetOutputTensorType
(absl::string_view output_name) const
Expected
< RankedTensorType >
GetSignature
(size_t signature_index) const
Expected
< SimpleSignature >
GetSignatureIndex
(absl::string_view signature_key) const
Expected
< size_t >
GetSignatureInputNames
(size_t signature_index) const
Expected
< std::vector< absl::string_view > >
GetSignatureInputNames
() const
Expected
< std::vector< absl::string_view > >
GetSignatureInputNames
(absl::string_view signature_key) const
Expected
< std::vector< absl::string_view > >
GetSignatureKeys
() const
Expected
< std::vector< absl::string_view > >
GetSignatureOutputNames
(size_t signature_index) const
Expected
< std::vector< absl::string_view > >
GetSignatureOutputNames
() const
Expected
< std::vector< absl::string_view > >
GetSignatureOutputNames
(absl::string_view signature_key) const
Expected
< std::vector< absl::string_view > >
GetSignatures
() const
Expected
< std::vector< SimpleSignature > >
Public static functions
CreateFromBuffer
( BufferRef
< uint8_t > buffer)
CreateFromFile
(const std::string & filename)
CreateFromNonOwnedHandle
(LiteRtModel model)
CreateFromOwnedHandle
(LiteRtModel model)
absl::string_view
Protected functions
Model
(LiteRtModel model, OwnHandle owned)
Public functions
FindSignature
Expected < SimpleSignature > FindSignature ( absl :: string_view signature_key ) const
Returns the SimpleSignature
object for the given signature key.
Returns the default signature if the signature key is empty.
GetInputTensorType
Expected < RankedTensorType > GetInputTensorType ( size_t signature_index , size_t input_index ) const
Returns the tensor type for the n-th input tensor.
GetInputTensorType
Expected < RankedTensorType > GetInputTensorType ( size_t signature_index , absl :: string_view input_name ) const
Returns the tensor type for the given input tensor name.
GetInputTensorType
Expected < RankedTensorType > GetInputTensorType ( absl :: string_view signature_key , absl :: string_view input_name ) const
Returns the tensor type for the given input tensor name.
GetInputTensorType
Expected < RankedTensorType > GetInputTensorType ( absl :: string_view input_name ) const
Gets the input tensor type of the default signature for a given input name.
GetNumSignatures
size_t GetNumSignatures () const
GetOutputTensorType
Expected < RankedTensorType > GetOutputTensorType ( size_t signature_index , size_t output_index ) const
Returns the tensor type for the n-th output tensor.
GetOutputTensorType
Expected < RankedTensorType > GetOutputTensorType ( size_t signature_index , absl :: string_view output_name ) const
Returns the tensor type for the given output tensor name.
GetOutputTensorType
Expected < RankedTensorType > GetOutputTensorType ( absl :: string_view signature_key , absl :: string_view output_name ) const
Returns the tensor type for the given output tensor name.
GetOutputTensorType
Expected < RankedTensorType > GetOutputTensorType ( absl :: string_view output_name ) const
Gets the output tensor type of the default signature for a given output name.
GetSignature
Expected < SimpleSignature > GetSignature ( size_t signature_index ) const
Returns the signature at the given index.
GetSignatureIndex
Expected < size_t > GetSignatureIndex ( absl :: string_view signature_key ) const
Returns the signature index for the given signature key.
Returns 0 if the signature key is empty.
GetSignatureInputNames
Expected < std :: vector < absl :: string_view > > GetSignatureInputNames ( size_t signature_index ) const
Returns the list of input names defined in the signature.
GetSignatureInputNames
Expected < std :: vector < absl :: string_view > > GetSignatureInputNames () const
Returns the list of input names defined in the signature.
GetSignatureInputNames
Expected < std :: vector < absl :: string_view > > GetSignatureInputNames ( absl :: string_view signature_key ) const
Returns the list of input names defined in the signature.
GetSignatureKeys
Expected < std :: vector < absl :: string_view > > GetSignatureKeys () const
Returns the list of signature key names defined in the signature.
GetSignatureOutputNames
Expected < std :: vector < absl :: string_view > > GetSignatureOutputNames ( size_t signature_index ) const
Returns the list of output names defined in the signature.
GetSignatureOutputNames
Expected < std :: vector < absl :: string_view > > GetSignatureOutputNames () const
Returns the list of output names defined in the signature.
GetSignatureOutputNames
Expected < std :: vector < absl :: string_view > > GetSignatureOutputNames ( absl :: string_view signature_key ) const
Returns the list of output names defined in the signature.
GetSignatures
Expected < std :: vector < SimpleSignature > > GetSignatures () const
Returns the list of signatures defined in the model.
Metadata
Expected < absl :: Span < const uint8_t > > Metadata ( const std :: string & metadata_key ) const
Model
Model()=default
Public static functions
CreateFromBuffer
Expected < Model > CreateFromBuffer( BufferRef < uint8_t > buffer )
Creates a model from a buffer.
The caller must ensure that the buffer remains valid for the lifetime of the model.
CreateFromNonOwnedHandle
Model CreateFromNonOwnedHandle( LiteRtModel model )
CreateFromOwnedHandle
Model CreateFromOwnedHandle( LiteRtModel model )
DefaultSignatureKey
absl::string_view DefaultSignatureKey()
Protected functions
Model
Model( LiteRtModel model, OwnHandle owned )
owned
TensorBuffer
object should take ownership of the provided tensor_buffer
handle.
