Skip to content

Commit 825c0ff

Browse files
committed
Merge pull request opencv#9874 from dkurt:fix_identity_permute_layer
2 parents 69f2590 + a3a446c commit 825c0ff

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

modules/dnn/src/layers/permute_layer.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ class PermuteLayerImpl : public PermuteLayer
117117
std::vector<MatShape> &internals) const
118118
{
119119
if(!_needsPermute)
120+
{
121+
Layer::getMemoryShapes(inputs, requiredOutputs, outputs, internals);
120122
return true;
123+
}
121124

122125
CV_Assert(inputs.size() > 0);
123126
CV_Assert((int)_numAxes == inputs[0].size());
@@ -253,7 +256,11 @@ class PermuteLayerImpl : public PermuteLayer
253256
if(!_needsPermute)
254257
{
255258
for (k = 0; k < ninputs; k++)
256-
outputs[k] = *inputs[k];
259+
{
260+
CV_Assert(outputs[k].total() == inputs[k]->total());
261+
if (outputs[k].data != inputs[k]->data)
262+
inputs[k]->copyTo(outputs[k]);
263+
}
257264
}
258265
else
259266
{

0 commit comments

Comments
 (0)