ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnkit::support::caffe::Backend< DType > Class Template Referencefinal

#include <Backend.h>

Collaboration diagram for nnkit::support::caffe::Backend< DType >:

Public Member Functions

 Backend (std::unique_ptr<::caffe::Net< DType > > &&net)
 
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

template<typename DType>
class nnkit::support::caffe::Backend< DType >

Definition at line 38 of file Backend.h.

Constructor & Destructor Documentation

◆ Backend()

template<typename DType >
nnkit::support::caffe::Backend< DType >::Backend ( std::unique_ptr<::caffe::Net< DType > > &&  net)
inline

Definition at line 41 of file Backend.h.

41 : _net{std::move(net)}
42 {
43 // DO NOTHING
44 }

Member Function Documentation

◆ prepare()

template<typename DType >
void nnkit::support::caffe::Backend< DType >::prepare ( const std::function< void(nnkit::TensorContext &)> &  f)
inlineoverride

Definition at line 47 of file Backend.h.

48 {
49 InputBlobContext<DType> blobs(*_net);
50 TensorContext<DType> tensors(blobs);
51 f(tensors);
52 }

◆ run()

template<typename DType >
void nnkit::support::caffe::Backend< DType >::run ( void  )
inlineoverridevirtual

Implements nnkit::Backend.

Definition at line 55 of file Backend.h.

55{ _net->Forward(); }

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

◆ teardown()

template<typename DType >
void nnkit::support::caffe::Backend< DType >::teardown ( const std::function< void(nnkit::TensorContext &)> &  f)
inlineoverride

Definition at line 58 of file Backend.h.

59 {
60 OutputBlobContext<DType> blobs(*_net);
61 TensorContext<DType> tensors(blobs);
62 f(tensors);
63 }

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