const auto &operands = _model->operands();
- // Disable compile phase
- // When ready to use interpreter backend, remove this config and use backend setting
- const auto env_disable_compile = config::ConfigManager::instance().get<bool>("DISABLE_COMPILE");
- if (env_disable_compile)
+ if (!checkCompilable())
{
_executor = std::make_shared<exec::interp::Interpreter>(_model->shareModel());
return;
_state = State::COMPILED;
}
+bool Compiler::checkCompilable()
+{
+ // Disable compile phase
+ // When ready to use interpreter backend, remove this config and use backend setting
+ const auto env_disable_compile = config::ConfigManager::instance().get<bool>("DISABLE_COMPILE");
+ if (env_disable_compile)
+ {
+ return false;
+ }
+
+ // TODO check unspecified operand shape
+
+ return true;
+}
+
} // namespace compiler
} // namespace neurun
State state(void) const { return _state; }
private:
+ /**
+ * @brief Check if model can compile
+ * @return @c true if model can compile, otherwise @c false
+ * @note This method don't check model correctness,\n
+ * so model verification should be done before calling this method
+ */
+ bool checkCompilable();
+
+private:
std::shared_ptr<graph::Graph> _model;
std::shared_ptr<exec::IExecutor> _executor;
State _state;