!4239 fix bug in opencl subgraph output tensor

Merge pull request !4239 from chenzupeng/master-lite
pull/4239/MERGE
mindspore-ci-bot 5 years ago committed by Gitee
commit afc98f0a27

@ -61,7 +61,9 @@ class LiteKernel {
const std::vector<lite::tensor::Tensor *> &outputs, const lite::Context *ctx,
const lite::Primitive *primitive)
: opParameter(parameter), inputs_(inputs), outputs_(outputs), primitive_(primitive), context_(ctx) {
opParameter->thread_num_ = ctx->thread_num_;
if (opParameter && ctx) {
opParameter->thread_num_ = ctx->thread_num_;
}
this->in_kernel_.clear();
this->out_kernel_.clear();
}
@ -100,7 +102,10 @@ class LiteKernel {
schema::PrimitiveType type() { return (schema::PrimitiveType)this->opParameter->type_; }
std::string type_str() { return schema::EnumNamePrimitiveType((schema::PrimitiveType)this->opParameter->type_); }
std::string type_str() {
return this->opParameter ? schema::EnumNamePrimitiveType((schema::PrimitiveType)this->opParameter->type_)
: "ERROR:undefined primitive!";
}
void SetInputs(const std::vector<lite::tensor::Tensor *> &inputs) { this->inputs_ = inputs; }

@ -56,6 +56,7 @@ int OpenCLExecutor::Run(std::vector<tensor::Tensor *> &inputs, std::vector<tenso
} else {
output->MallocData(allocator);
}
output->set_allocator(allocator);
}
session::CallBackParam callbackParam;
callbackParam.name_callback_param = kernel->Name();
@ -91,7 +92,7 @@ int OpenCLExecutor::Run(std::vector<tensor::Tensor *> &inputs, std::vector<tenso
return RET_ERROR;
}
if (outTensor->GetFormat() != schema::Format_NHWC) {
TransformTensorLayout(outTensor, outTensor->GetFormat(), schema::Format_NHWC, false);
TransformTensorLayout(outTensor, outTensor->GetFormat(), schema::Format_NHWC, false);
}
}
return RET_OK;

@ -157,7 +157,7 @@ kernel::LiteKernel *Scheduler::CreateSubKernel(const std::vector<kernel::LiteKer
input_tensors.emplace_back(tensor);
}
}
for (auto tensor : tail_kernel->GetInputs()) {
for (auto tensor : tail_kernel->GetOutputs()) {
if (tensor->Data() == nullptr) {
output_tensors.emplace_back(tensor);
}

Loading…
Cancel
Save