ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnkit::support::tflite::AbstractBackend Class Referenceabstract

#include <AbstractBackend.h>

Collaboration diagram for nnkit::support::tflite::AbstractBackend:

Public Member Functions

virtual ~AbstractBackend ()=default
 
virtual ::tflite::Interpreter & interpreter (void)=0
 
void prepare (const std::function< void(TensorContext &)> &f) override
 
void run (void) override
 
void teardown (const std::function< void(TensorContext &)> &f) override
 
- Public Member Functions inherited from nnkit::Backend
virtual ~Backend ()=default
 
virtual void prepare (const std::function< void(TensorContext &)> &f)=0
 
virtual void teardown (const std::function< void(TensorContext &)> &f)=0
 

Detailed Description

Definition at line 30 of file AbstractBackend.h.

Constructor & Destructor Documentation

◆ ~AbstractBackend()

virtual nnkit::support::tflite::AbstractBackend::~AbstractBackend ( )
virtualdefault

Member Function Documentation

◆ interpreter()

virtual ::tflite::Interpreter & nnkit::support::tflite::AbstractBackend::interpreter ( void  )
pure virtual

Implemented in ConvBackend.

Referenced by prepare(), run(), and teardown().

◆ prepare()

void nnkit::support::tflite::AbstractBackend::prepare ( const std::function< void(TensorContext &)> &  f)
override

Definition at line 32 of file Backend.cpp.

33{
34 ensure(interpreter().AllocateTensors());
35
36 InputTensorSet inputs(interpreter());
37 TensorContext ctx(inputs);
38 f(ctx);
39}
virtual ::tflite::Interpreter & interpreter(void)=0

References interpreter().

◆ run()

void nnkit::support::tflite::AbstractBackend::run ( void  )
overridevirtual

Implements nnkit::Backend.

Definition at line 41 of file Backend.cpp.

41{ ensure(interpreter().Invoke()); }

References interpreter().

Referenced by package.infer.session::inference().

◆ teardown()

void nnkit::support::tflite::AbstractBackend::teardown ( const std::function< void(TensorContext &)> &  f)
override

Definition at line 43 of file Backend.cpp.

44{
45 OutputTensorSet outputs(interpreter());
46 TensorContext ctx(outputs);
47 f(ctx);
48}

References interpreter().


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