#include "dumper/dot/DotDumper.h"
#include "linear/Linear.h"
#include "exec/Executor.h"
+#include "exec/interp/Interpreter.h"
namespace neurun
{
const auto env_disable_compile = config::ConfigManager::instance().get<bool>("DISABLE_COMPILE");
if (env_disable_compile)
{
- _plan = std::make_shared<Plan>();
+ _executor = std::make_shared<exec::interp::Interpreter>(_model->shareModel());
return;
}
class Interpreter final : public IExecutor
{
public:
- Interpreter(const std::shared_ptr<const neurun::compiler::Plan> &plan) : _plan{plan}
+ Interpreter(const std::shared_ptr<const model::Model> &model) : _model{model}
{
// DO NOTHING
}
public:
/**
+ * @brief Return graph model
+ * @return Graph model
+ */
+ const model::Model &model() { return *_model; }
+ /**
* @brief Set input data's information
* @param[in] index Input index
* @param[in] type Input data's type info
void execute(void);
private:
- std::shared_ptr<const neurun::compiler::Plan> _plan;
+ std::shared_ptr<const model::Model> _model;
};
} // namespace interp
return ANEURALNETWORKS_UNEXPECTED_NULL;
}
- // Can handle compiled state only
- if (compilation->state() != neurun::compiler::State::COMPILED)
- {
- VERBOSE(NNAPI::Execution) << "create: Not compiled yet" << std::endl;
- return ANEURALNETWORKS_BAD_STATE;
- }
-
std::shared_ptr<neurun::exec::IExecutor> executor;
compilation->publish(executor);
+ if (executor == nullptr)
+ {
+ VERBOSE(NNAPI::Execution) << "create: Never compiled yet" << std::endl;
+ return ANEURALNETWORKS_BAD_STATE;
+ }
+
*execution = new (std::nothrow) ANeuralNetworksExecution{executor};
if (*execution == nullptr)
{