| @@ -444,11 +444,6 @@ build_protobuf() { | |||||
| fi | fi | ||||
| } | } | ||||
| build_gtest() { | |||||
| cd ${BASEPATH} | |||||
| git submodule update --init --recursive third_party/googletest | |||||
| } | |||||
| gene_clhpp() { | gene_clhpp() { | ||||
| CL_SRC_DIR="${BASEPATH}/mindspore/lite/src/runtime/kernel/opencl/cl" | CL_SRC_DIR="${BASEPATH}/mindspore/lite/src/runtime/kernel/opencl/cl" | ||||
| for sub_dir in "${CL_SRC_DIR}"/* | for sub_dir in "${CL_SRC_DIR}"/* | ||||
| @@ -530,9 +525,11 @@ build_lite() | |||||
| build_protobuf | build_protobuf | ||||
| fi | fi | ||||
| build_flatbuffer | build_flatbuffer | ||||
| build_gtest | |||||
| cd "${BASEPATH}/mindspore/lite" | cd "${BASEPATH}/mindspore/lite" | ||||
| if [[ "${INC_BUILD}" == "off" ]]; then | |||||
| rm -rf build | |||||
| fi | |||||
| mkdir -pv build | mkdir -pv build | ||||
| cd build | cd build | ||||
| BUILD_TYPE="Release" | BUILD_TYPE="Release" | ||||
| @@ -39,6 +39,7 @@ class Model { | |||||
| protected: | protected: | ||||
| std::shared_ptr<ModelImpl> modelImpl = nullptr; | std::shared_ptr<ModelImpl> modelImpl = nullptr; | ||||
| }; | }; | ||||
| class ModelBuilder { | class ModelBuilder { | ||||
| public: | public: | ||||
| struct OutEdge { | struct OutEdge { | ||||
| @@ -54,4 +55,3 @@ class ModelBuilder { | |||||
| } // namespace mindspore | } // namespace mindspore | ||||
| #endif // MINDSPORE_LITE_INCLUDE_MODEL_H | #endif // MINDSPORE_LITE_INCLUDE_MODEL_H | ||||
| @@ -68,44 +68,6 @@ int LiteSession::ConvertTensors(const lite::Model *model) { | |||||
| return RET_OK; | return RET_OK; | ||||
| } | } | ||||
| int LiteSession::ConvertKernels(const lite::Model *model, Context *context) { | |||||
| // MS_EXCEPTION_IF_NULL(model); | |||||
| // auto meta_graph = model->GetMetaGraph(); | |||||
| // MS_EXCEPTION_IF_NULL(meta_graph); | |||||
| // uint32_t kernelCount = meta_graph->nodes()->size(); | |||||
| // for (uint32_t i = 0; i < kernelCount; i++) { | |||||
| // auto cNode = meta_graph->nodes()->GetAs<schema::CNode>(i); | |||||
| // std::vector<tensor::Tensor *> inputs; | |||||
| // std::vector<tensor::Tensor *> outputs; | |||||
| // auto inIndexes = cNode->inputIndex(); | |||||
| // for (size_t j = 0; j < inIndexes->size(); j++) { | |||||
| // inputs.emplace_back(this->tensors.at(size_t(inIndexes->GetAs<uint32_t>(j)))); | |||||
| // } | |||||
| // auto outIndexes = cNode->outputIndex(); | |||||
| // for (size_t j = 0; j < outIndexes->size(); j++) { | |||||
| // outputs.emplace_back(this->tensors.at(size_t(outIndexes->GetAs<uint32_t>(j)))); | |||||
| // } | |||||
| // const auto *primitive = model->GetOp(cNode->name()->str()); | |||||
| // if (primitive == nullptr) { | |||||
| // MS_LOG(ERROR) << "Op " << cNode->name()->str() << " should exist in model"; | |||||
| // return RET_ERROR; | |||||
| // } | |||||
| // auto ret = primitive->InferShape(inputs, outputs); | |||||
| // if (0 != ret) { | |||||
| // MS_LOG(ERROR) << "InferShape failed, node : " << cNode->name()->str(); | |||||
| // return ret; | |||||
| // } | |||||
| // auto *kernel = lite::KernelFactory::GetInstance()->GetKernel(inputs, outputs, cNode, context); | |||||
| // if (nullptr == kernel) { | |||||
| // MS_LOG(ERROR) << "Create kernel return nullptr, name: " << cNode->name()->str() | |||||
| // << ", type: " << schema::EnumNamePrimitiveType(cNode->primitive()->value_type()); | |||||
| // return RET_ERROR; | |||||
| // } | |||||
| // kernels.emplace_back(kernel); | |||||
| // } | |||||
| return RET_OK; | |||||
| } | |||||
| void LiteSession::InitGraphInOutTensor(const lite::Model *model) { | void LiteSession::InitGraphInOutTensor(const lite::Model *model) { | ||||
| auto meta_graph = model->GetMetaGraph(); | auto meta_graph = model->GetMetaGraph(); | ||||
| MS_ASSERT(this->input_map.empty()); | MS_ASSERT(this->input_map.empty()); | ||||
| @@ -56,7 +56,7 @@ class LiteSession : public session::LiteSession { | |||||
| protected: | protected: | ||||
| int ConvertTensors(const lite::Model *model); | int ConvertTensors(const lite::Model *model); | ||||
| int ConvertKernels(const lite::Model *model, Context *context); | |||||
| void InitGraphInOutTensor(const lite::Model *model); | void InitGraphInOutTensor(const lite::Model *model); | ||||
| protected: | protected: | ||||
| @@ -316,6 +316,8 @@ int Benchmark::MarkPerformance() { | |||||
| int Benchmark::MarkAccuracy() { | int Benchmark::MarkAccuracy() { | ||||
| MS_LOG(INFO) << "MarkAccuracy"; | MS_LOG(INFO) << "MarkAccuracy"; | ||||
| for (size_t i = 0; i < msInputs.size(); i++) { | for (size_t i = 0; i < msInputs.size(); i++) { | ||||
| MS_ASSERT(msInputs.at(i) != nullptr); | |||||
| MS_ASSERT(msInputs.at(i)->data_type() == TypeId::kNumberTypeFloat32); | |||||
| auto inData = reinterpret_cast<float *>(msInputs.at(i)->MutableData()); | auto inData = reinterpret_cast<float *>(msInputs.at(i)->MutableData()); | ||||
| std::cout << "InData" << i << ": "; | std::cout << "InData" << i << ": "; | ||||
| for (size_t j = 0; j < 20; j++) { | for (size_t j = 0; j < 20; j++) { | ||||
| @@ -331,14 +333,6 @@ int Benchmark::MarkAccuracy() { | |||||
| ReadCalibData(); | ReadCalibData(); | ||||
| CompareOutput(); | CompareOutput(); | ||||
| if (cleanData) { | |||||
| for (auto &msOutput : msOutputs) { | |||||
| for (auto &outputTensor : msOutput.second) { | |||||
| delete outputTensor; | |||||
| } | |||||
| } | |||||
| msOutputs.clear(); | |||||
| } | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -407,10 +401,6 @@ int Benchmark::RunBenchmark(const std::string &deviceType) { | |||||
| } | } | ||||
| if (cleanData) { | if (cleanData) { | ||||
| for (auto &msInput : msInputs) { | |||||
| delete msInput; | |||||
| } | |||||
| msInputs.clear(); | |||||
| for (auto &data : calibData) { | for (auto &data : calibData) { | ||||
| data.second->shape.clear(); | data.second->shape.clear(); | ||||
| data.second->data.clear(); | data.second->data.clear(); | ||||