Skip to content

Commit 78c1c25

Browse files
authored
relax aten.view conversion constraint (#94)
Only convert aten.view to tcp.custom_op when the `size` array is non-constant. The rest will be handled through torch-to-tosa. TODO: send out an upstream PR to fix` tosa.reshape` size calculation logic.
1 parent 29062f8 commit 78c1c25

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/Conversion/TorchToTcp/TcpCustomOp.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,11 @@ class ConvertAtenViewOp : public OpConversionPattern<AtenViewOp> {
299299
torch_to_tcp::TorchToTcpCustomOpConversionHelper helper{op, rewriter,
300300
getTypeConverter()};
301301
Value self = adaptor.getSelf();
302-
auto srcType = self.getType().cast<RankedTensorType>();
303-
auto resultType =
304-
getTypeConverter()->convertType(op.getType()).cast<RankedTensorType>();
305-
306302
SmallVector<int64_t> size;
307-
// static shape will be handled through TOSA dialect
308-
if (matchPattern(op.getSize(), m_TorchListOfConstantInts(size)) &&
309-
srcType.hasStaticShape() && resultType.hasStaticShape())
310-
return rewriter.notifyMatchFailure(op, "only dynamic shape is supported");
303+
// static size array will be handled through TOSA dialect
304+
if (matchPattern(op.getSize(), m_TorchListOfConstantInts(size)))
305+
return rewriter.notifyMatchFailure(op,
306+
"only non-constant size is supported");
311307

312308
helper.addOperand("self", self);
313309
Operation *primListOp = op.getSize().getDefiningOp();

0 commit comments

Comments
 (0)