MNN/source/core/BackendFactory.cpp

27 lines
718 B
C++
Raw Normal View History

2019-04-17 10:49:11 +08:00
//
// BackendFactory.cpp
// MNN
//
// Created by MNN on 2018/07/30.
// Copyright © 2018, Alibaba Group Holding Limited
//
2019-12-27 22:16:57 +08:00
#include "core/BackendFactory.hpp"
//#include <MNN/core/CPUBackend.hpp
#include "core/Macro.h"
2019-04-17 10:49:11 +08:00
namespace MNN {
Backend* BackendFactory::create(const Backend::Info& info) {
auto creator = MNNGetExtraBackendCreator(info.type);
if (nullptr == creator) {
MNN_PRINT("Create Backend Failed because no creator for %d\n", info.type);
return nullptr;
}
auto backend = creator->onCreate(info);
if (nullptr == backend) {
MNN_PRINT("Create Backend failed, the creator return nullptr, type = %d\n", info.type);
}
return backend;
}
} // namespace MNN