[MNN:Bugfix] Fix bug for NC4HW4 with least than 4 dimenstion

This commit is contained in:
xiaying 2019-11-15 16:30:33 +08:00
parent e93e8dcbe8
commit ac84e1190a
2 changed files with 5 additions and 2 deletions

View File

@ -87,7 +87,6 @@ Pipeline::Unit::Unit(const Op* op, const std::vector<Tensor*>& inputs, const std
if (nullptr != typeStr) {
mContent->type = typeStr;
}
mComputer = SizeComputerSuite::get()->search(mType);
}
@ -178,6 +177,11 @@ ErrorCode Pipeline::Unit::prepare(Backend* bn, Backend* cpuBn) {
if (o->size() <= 0) {
ready = false;
}
if (o->dimensions() < 4 && TensorUtils::getDescribe(o)->dimensionFormat == MNN_DATA_FORMAT_NC4HW4) {
for (auto index = o->dimensions(); index < 4; ++index) {
o->setLength(index, 1);
}
}
}
mContent->flops = SizeComputer::computeFlops(mOriginOp, mInputs, mOutputs);

View File

@ -102,7 +102,6 @@ public:
private:
bool mConst = false;
const SizeComputer* mComputer = nullptr;
};
protected: