ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::compiler::CompilerFactory Class Reference

#include <CompilerFactory.h>

Public Member Functions

std::unique_ptr< ICompilercreate (std::unique_ptr< ir::NNPkg > nnpkg, CompilerOptions *copts, const ir::train::TrainingInfo *training_info=nullptr)
 Create ICompiler instance. Ownership of nnpkg is moved to ICompiler instance.
 

Static Public Member Functions

static CompilerFactoryget ()
 

Detailed Description

Definition at line 29 of file CompilerFactory.h.

Member Function Documentation

◆ create()

std::unique_ptr< ICompiler > onert::compiler::CompilerFactory::create ( std::unique_ptr< ir::NNPkg nnpkg,
CompilerOptions copts,
const ir::train::TrainingInfo training_info = nullptr 
)

Create ICompiler instance. Ownership of nnpkg is moved to ICompiler instance.

Compiler is designed on assumption that caller will not use nnpkg after calling this function. So ownership of nnpkg is moved to ICompiler instance to handle memory overhead of nnpkg. If caller want to maintain nnpkg after calling this function, caller should clone nnpkg before calling this function.

Parameters
[in]nnpkgPackage to compile
[in]coptsCompiler options
[in]training_infoTraining info if it is a training model, otherwise nullptr
Returns
ICompiler instance pointer which owns nnpkg

Definition at line 31 of file CompilerFactory.cc.

34{
35 // Returing compiler for training
36 if (training_info)
37 return std::make_unique<train::TrainingCompiler>(std::move(nnpkg), copts, *training_info);
38
39 // Returing compiler for inference
40 return std::make_unique<Compiler>(std::move(nnpkg), copts);
41}

Referenced by nnfw_session::prepare().

◆ get()

CompilerFactory & onert::compiler::CompilerFactory::get ( )
static

Definition at line 25 of file CompilerFactory.cc.

26{
27 static CompilerFactory singleton;
28 return singleton;
29}

Referenced by nnfw_session::prepare().


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