reshape, "Cannot collapse dynamic dims to more than one dimension");
}
- if (operandTy == resultTy) {
- rewriter.replaceOp(reshape, adaptor.getOperands()[0]);
- return success();
- }
-
SmallVector<ReassociationExprs, 4> reassociationMap;
if (!createReassociationMapsForCollapse(rewriter, operandTy.getShape(),
resultTy.getShape(),
ShapedType resultTy = reshape.getType().template cast<ShapedType>();
bool isDynamic = !operandTy.hasStaticShape();
- if (operandTy == resultTy) {
- rewriter.replaceOp(reshape, adaptor.getOperands()[0]);
- return success();
- }
-
if (isDynamic && operandTy.getRank() != 1) {
return rewriter.notifyMatchFailure(
reshape, "Cannot expand dynamic dims from more than one dimension");
ShapedType resultTy = reshape.getType().template cast<ShapedType>();
bool isDynamic = !operandTy.hasStaticShape();
- if (operandTy == resultTy) {
- rewriter.replaceOp(reshape, adaptor.getOperands()[0]);
- return success();
- }
-
SmallVector<int64_t> intermediateShape;
if (!findIntermediateShape(resultTy.getShape(), operandTy.getShape(),
intermediateShape, isDynamic)) {
patterns->add<MaterializeResizeBroadcast>(patterns->getContext(),
/*benefit=*/300);
+ patterns->add<ReshapeConverterCollapse>(patterns->getContext(),
+ /*benefit=*/100);
+ patterns->add<ReshapeConverterExpand>(patterns->getContext(),
+ /*benefit=*/200);
+ patterns->add<ReshapeConverterCollapseExpand>(patterns->getContext(),
+ /*benefit=*/300);
+
patterns->add<
// clang-format off
PointwiseConverter<tosa::AddOp>,
ArgMaxConverter,
ConcatConverter,
GatherConverter,
- ReshapeConverterCollapse,
- ReshapeConverterExpand,
- ReshapeConverterCollapseExpand,
RescaleConverter,
ReverseConverter,
TableConverter,