ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnkit::support::onnx::Backend Class Referencefinal

#include <Backend.h>

Collaboration diagram for nnkit::support::onnx::Backend:

Public Member Functions

 Backend (const std::string &onnx_path)
 
void prepare (const std::function< void(nnkit::TensorContext &)> &f) override
 
void run (void) override
 
void teardown (const std::function< void(nnkit::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 31 of file Backend.h.

Constructor & Destructor Documentation

◆ Backend()

nnkit::support::onnx::Backend::Backend ( const std::string &  onnx_path)
inline

Definition at line 34 of file Backend.h.

34 : _runner(onnx_path)
35 {
36 // DO NOTHING
37 }

Member Function Documentation

◆ prepare()

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

Definition at line 27 of file Backend.cpp.

28{
29 // Prepare input and output tensors
30 _runner.prepareInputs();
31 _runner.prepareOutputs();
32
33 TensorContext ctx(_runner.inputs());
34 f(ctx);
35}
TensorSet & inputs(void)
Definition Runner.h:43

References nnkit::support::onnx::Runner::inputs(), nnkit::support::onnx::Runner::prepareInputs(), and nnkit::support::onnx::Runner::prepareOutputs().

◆ run()

void nnkit::support::onnx::Backend::run ( void  )
overridevirtual

Implements nnkit::Backend.

Definition at line 37 of file Backend.cpp.

37{ _runner.run(); }

References nnkit::support::onnx::Runner::run().

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

◆ teardown()

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

Definition at line 39 of file Backend.cpp.

40{
41 TensorContext ctx(_runner.outputs());
42 f(ctx);
43}
TensorSet & outputs(void)
Definition Runner.h:44

References nnkit::support::onnx::Runner::outputs().


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