36#ifndef ML_MODEL_RUNNER_H 
   37#define ML_MODEL_RUNNER_H 
   65  typename std::enable_if<std::is_fundamental<T>::value, T>::type 
evaluate() {
 
 
   71  typename std::enable_if<
 
   72      std::is_fundamental<typename std::remove_pointer<T>::type>::value,
 
   75    using BaseType = 
typename std::remove_pointer<T>::type;
 
   77    T ret = 
static_cast<T
>(malloc(
SerDes->getMessageLength()));
 
   78    memcpy(ret, res, 
SerDes->getMessageLength());
 
   79    dataSize = 
SerDes->getMessageLength() / 
sizeof(BaseType);
 
 
   96  template <
typename U, 
typename T, 
typename... Types>
 
   98                        const std::pair<U, Types> &...var2) {
 
   99    SerDes->setFeature(var1.first, var1.second);
 
 
  103  template <
typename U, 
typename T, 
typename... Types>
 
  105                        const std::pair<U, Types> &&...var2) {
 
  106    SerDes->setFeature(var1.first, var1.second);
 
 
  122                llvm::LLVMContext *
Ctx = 
nullptr)
 
 
  148      SerDes = std::make_unique<JsonSerDes>();
 
  151      SerDes = std::make_unique<BitstreamSerDes>();
 
  155      SerDes = std::make_unique<ProtobufSerDes>();
 
  158      SerDes = std::make_unique<TensorflowSerDes>();
 
 
 
Bitstream Serialization/Deserialization which sends header information followed by the raw data.
MLModelRunner - The main interface for interacting with the ML models.
const SerDesKind SerDesType
std::unique_ptr< BaseSerDes > SerDes
SerDesKind getSerDesKind() const
Kind
Type of the MLModelRunner.
void setRequest(void *request)
Mainly used in the case of gRPC where the request object is not known explicitly.
void populateFeatures(const std::pair< U, T > &var1, const std::pair< U, Types > &...var2)
User-facing interface for setting the features to be sent to the model.
MLModelRunner(Kind Type, llvm::LLVMContext *Ctx=nullptr)
std::enable_if< std::is_fundamental< T >::value, T >::type evaluate()
Main user-facing method for interacting with the ML models.
MLModelRunner(Kind Type, SerDesKind SerDesType, llvm::LLVMContext *Ctx=nullptr)
MLModelRunner(const MLModelRunner &)=delete
void populateFeatures(const std::pair< U, T > &&var1, const std::pair< U, Types > &&...var2)
virtual ~MLModelRunner()=default
std::enable_if< std::is_fundamental< typenamestd::remove_pointer< T >::type >::value, void >::type evaluate(T &data, size_t &dataSize)
Main user-facing method for interacting with the ML models.
MLModelRunner & operator=(const MLModelRunner &)=delete
virtual void * evaluateUntyped()=0
Should be implemented by the derived class to call the model and get the result.
void setResponse(void *response)
Mainly used in the case of gRPC where the response object is not known explicitly.
virtual void requestExit()=0
Json Serialization/Deserialization using LLVM's json library.
SerDesKind
This is the base class for SerDes.
Protobuf Serialization/Deserialization to support gRPC communication.
Serialization/Deserialization to support TF AOT models.