MNN
1.0
|
#include <Interpreter.hpp>
Public 成员函数 | |
~Interpreter () | |
Session * | createSession (const ScheduleConfig &config) |
create session with schedule config. created session will be managed in net. 更多... | |
Session * | createMultiPathSession (const std::vector< ScheduleConfig > &configs) |
create multi-path session with schedule configs. created session will be managed in net. 更多... | |
bool | releaseSession (Session *session) |
release session. 更多... | |
void | resizeSession (Session *session) |
call this function to get tensors ready. output tensor buffer (host or deviceId) should be retrieved after resize of any input tensor. 更多... | |
void | releaseModel () |
call this function if don't need resize or create session any more, it will save a few memory that equal to the size of model buffer 更多... | |
ErrorCode | runSession (Session *session) const |
run session. 更多... | |
ErrorCode | runSessionWithCallBack (const Session *session, const TensorCallBack &before, const TensorCallBack &end, bool sync=false) const |
ErrorCode | runSessionWithCallBackInfo (const Session *session, const TensorCallBackWithInfo &before, const TensorCallBackWithInfo &end, bool sync=false) const |
Tensor * | getSessionInput (const Session *session, const char *name) |
get input tensor for given name. 更多... | |
Tensor * | getSessionOutput (const Session *session, const char *name) |
get output tensor for given name. 更多... | |
const std::map< std::string, Tensor * > & | getSessionOutputAll (const Session *session) const |
get all input tensors. 更多... | |
const std::map< std::string, Tensor * > & | getSessionInputAll (const Session *session) const |
get all output tensors. 更多... | |
void | resizeTensor (Tensor *tensor, const std::vector< int > &dims) |
resize given tensor. 更多... | |
const Backend * | getBackend (const Session *session, const Tensor *tensor) const |
get backend used to create given tensor. 更多... | |
const char * | bizCode () const |
get business code (model identifier). 更多... | |
静态 Public 成员函数 | |
static Interpreter * | createFromFile (const char *file) |
create net from file. 更多... | |
static Interpreter * | createFromBuffer (const void *buffer, size_t size) |
create net from buffer. 更多... | |
net data holder. multiple sessions could share same net.
MNN::Interpreter::~Interpreter | ( | ) |
const char* MNN::Interpreter::bizCode | ( | ) | const |
get business code (model identifier).
|
static |
create net from buffer.
buffer | given data buffer. |
size | size of data buffer. |
|
static |
create net from file.
file | given file. |
Session* MNN::Interpreter::createMultiPathSession | ( | const std::vector< ScheduleConfig > & | configs | ) |
create multi-path session with schedule configs. created session will be managed in net.
configs | session schedule configs. |
Session* MNN::Interpreter::createSession | ( | const ScheduleConfig & | config | ) |
create session with schedule config. created session will be managed in net.
config | session schedule config. |
const Backend* MNN::Interpreter::getBackend | ( | const Session * | session, |
const Tensor * | tensor | ||
) | const |
get backend used to create given tensor.
session | given session. |
tensor | given tensor. |
Tensor* MNN::Interpreter::getSessionInput | ( | const Session * | session, |
const char * | name | ||
) |
get input tensor for given name.
session | given session. |
name | given name. if NULL, return first input. |
const std::map<std::string, Tensor*>& MNN::Interpreter::getSessionInputAll | ( | const Session * | session | ) | const |
get all output tensors.
session | given session. |
Tensor* MNN::Interpreter::getSessionOutput | ( | const Session * | session, |
const char * | name | ||
) |
get output tensor for given name.
session | given session. |
name | given name. if NULL, return first output. |
const std::map<std::string, Tensor*>& MNN::Interpreter::getSessionOutputAll | ( | const Session * | session | ) | const |
get all input tensors.
session | given session. |
void MNN::Interpreter::releaseModel | ( | ) |
call this function if don't need resize or create session any more, it will save a few memory that equal to the size of model buffer
bool MNN::Interpreter::releaseSession | ( | Session * | session | ) |
release session.
session | given session. |
void MNN::Interpreter::resizeSession | ( | Session * | session | ) |
call this function to get tensors ready. output tensor buffer (host or deviceId) should be retrieved after resize of any input tensor.
session | given session. |
void MNN::Interpreter::resizeTensor | ( | Tensor * | tensor, |
const std::vector< int > & | dims | ||
) |
resize given tensor.
tensor | given tensor. |
dims | new dims. at most 6 dims. |
ErrorCode MNN::Interpreter::runSession | ( | Session * | session | ) | const |
run session.
session | given session. |
ErrorCode MNN::Interpreter::runSessionWithCallBack | ( | const Session * | session, |
const TensorCallBack & | before, | ||
const TensorCallBack & | end, | ||
bool | sync = false |
||
) | const |
ErrorCode MNN::Interpreter::runSessionWithCallBackInfo | ( | const Session * | session, |
const TensorCallBackWithInfo & | before, | ||
const TensorCallBackWithInfo & | end, | ||
bool | sync = false |
||
) | const |