From b8066ce8fe369fad488b8a23c1038ff0d4cf5b77 Mon Sep 17 00:00:00 2001 From: Johan Gunnarsson Date: Mon, 19 May 2025 15:06:32 +0200 Subject: [PATCH] MLBEDSW-10826: Fix the axis attribute adjustment This axis attribute refers to the IFM rank. There are ops where IFM rank is not equal to OFM rank, such as Reduce Min/Max with keep_dims = false. The correct way is to use IFM rank as the base for this adjustment. Signed-off-by: Johan Gunnarsson Change-Id: I5aab7efef84b720fd15c8735f5c88df76ac24952 --- ethosu/regor/compiler/scheduler_packing.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ethosu/regor/compiler/scheduler_packing.cpp b/ethosu/regor/compiler/scheduler_packing.cpp index ec1cd006..bc89441d 100644 --- a/ethosu/regor/compiler/scheduler_packing.cpp +++ b/ethosu/regor/compiler/scheduler_packing.cpp @@ -629,10 +629,11 @@ std::unique_ptr SchedulerPacking::MakeSchedulerOperation(Ope } // Adjust axis attribute if tensors have been reshaped - if ( schedOp->Type() != OpType::Passthrough && schedOp->HasAttribute() ) + if ( schedOp->HasAttribute() ) { auto attr = schedOp->Attribute(); - int paddedAxes = schedOp->Output(TensorUsage::OFM)->shape.Size() - op->Output(TensorUsage::OFM)->shape.Size(); + // The axis attribute refers to the IFM rank + int paddedAxes = schedOp->Input(TensorUsage::IFM)->shape.Size() - op->Input(TensorUsage::IFM)->shape.Size(); assert(paddedAxes >= 0); attr->axis += paddedAxes; assert(attr->axis < schedOp->Input(TensorUsage::IFM)->shape.Size()); -- GitLab