Skip to content

Commit 3e84053

Browse files
fjsyrmiafjankovi
authored andcommitted
[mlir] Tosa reshape fix
1 parent 5dc9e87 commit 3e84053

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mlir/lib/Dialect/Tosa/IR/TosaOps.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,10 +928,16 @@ LogicalResult tosa::ReshapeOp::inferReturnTypeComponents(
928928
// dimension.
929929
int64_t numElements = inputShape.getNumElements();
930930
int64_t staticMul = 1;
931-
for (auto val : newShapeValue) {
931+
int i = 0;
932+
for (auto &val : newShapeValue) {
933+
if (val == 0) {
934+
// Swap 0 dim with corresponding input dim
935+
val = inputShape.getDimSize(i);
936+
}
932937
if (!ShapedType::isDynamic(val)) {
933938
staticMul *= val;
934939
}
940+
i++;
935941
}
936942

937943
// Determine the length of the dynamic dimension.

0 commit comments

Comments
 (0)