LLVM  15.0.0git
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::MLModelRunner Class Referenceabstract

MLModelRunner interface: abstraction of a mechanism for evaluating a tensorflow "saved model". More...

#include "llvm/Analysis/MLModelRunner.h"

Inheritance diagram for llvm::MLModelRunner:
Inheritance graph
[legend]
Collaboration diagram for llvm::MLModelRunner:
Collaboration graph
[legend]

Public Types

enum  Kind : int { Kind::Unknown, Kind::Release, Kind::Development, Kind::NoOp }
 

Public Member Functions

 MLModelRunner (const MLModelRunner &)=delete
 
MLModelRunneroperator= (const MLModelRunner &)=delete
 
virtual ~MLModelRunner ()=default
 
template<typename T >
T evaluate ()
 
template<typename T , typename I >
TgetTensor (I FeatureID)
 
template<typename T , typename I >
const TgetTensor (I FeatureID) const
 
void * getTensorUntyped (size_t Index)
 
const void * getTensorUntyped (size_t Index) const
 
Kind getKind () const
 

Protected Member Functions

 MLModelRunner (LLVMContext &Ctx, Kind Type, size_t NrInputs)
 
virtual void * evaluateUntyped ()=0
 
void setUpBufferForTensor (size_t Index, const TensorSpec &Spec, void *Buffer)
 

Protected Attributes

LLVMContextCtx
 
const Kind Type
 

Detailed Description

MLModelRunner interface: abstraction of a mechanism for evaluating a tensorflow "saved model".

NOTE: feature indices are expected to be consistent all accross MLModelRunners (pertaining to the same model), and also Loggers (see TFUtils.h)

Definition at line 24 of file MLModelRunner.h.

Member Enumeration Documentation

◆ Kind

Enumerator
Unknown 
Release 
Development 
NoOp 

Definition at line 50 of file MLModelRunner.h.

Constructor & Destructor Documentation

◆ MLModelRunner() [1/2]

llvm::MLModelRunner::MLModelRunner ( const MLModelRunner )
delete

◆ ~MLModelRunner()

virtual llvm::MLModelRunner::~MLModelRunner ( )
virtualdefault

◆ MLModelRunner() [2/2]

llvm::MLModelRunner::MLModelRunner ( LLVMContext Ctx,
Kind  Type,
size_t  NrInputs 
)
inlineprotected

Definition at line 54 of file MLModelRunner.h.

References assert(), and Unknown.

Member Function Documentation

◆ evaluate()

template<typename T >
T llvm::MLModelRunner::evaluate ( )
inline

Definition at line 31 of file MLModelRunner.h.

References evaluateUntyped(), and T.

◆ evaluateUntyped()

virtual void* llvm::MLModelRunner::evaluateUntyped ( )
protectedpure virtual

Referenced by evaluate().

◆ getKind()

Kind llvm::MLModelRunner::getKind ( ) const
inline

Definition at line 51 of file MLModelRunner.h.

References Type.

◆ getTensor() [1/2]

template<typename T , typename I >
T* llvm::MLModelRunner::getTensor ( I  FeatureID)
inline

Definition at line 35 of file MLModelRunner.h.

References getTensorUntyped(), and T.

◆ getTensor() [2/2]

template<typename T , typename I >
const T* llvm::MLModelRunner::getTensor ( I  FeatureID) const
inline

Definition at line 40 of file MLModelRunner.h.

References getTensorUntyped(), and T.

◆ getTensorUntyped() [1/2]

void* llvm::MLModelRunner::getTensorUntyped ( size_t  Index)
inline

Definition at line 45 of file MLModelRunner.h.

Referenced by getTensor().

◆ getTensorUntyped() [2/2]

const void* llvm::MLModelRunner::getTensorUntyped ( size_t  Index) const
inline

Definition at line 46 of file MLModelRunner.h.

◆ operator=()

MLModelRunner& llvm::MLModelRunner::operator= ( const MLModelRunner )
delete

◆ setUpBufferForTensor()

void llvm::MLModelRunner::setUpBufferForTensor ( size_t  Index,
const TensorSpec Spec,
void *  Buffer 
)
inlineprotected

Member Data Documentation

◆ Ctx

LLVMContext& llvm::MLModelRunner::Ctx
protected

Definition at line 69 of file MLModelRunner.h.

◆ Type

const Kind llvm::MLModelRunner::Type
protected

Definition at line 70 of file MLModelRunner.h.

Referenced by getKind().


The documentation for this class was generated from the following file: