google-ai-edge / ai-edge-torch

Supporting PyTorch models with the Google AI Edge TFLite runtime.
Apache License 2.0
199 stars 23 forks source link

Fix BuildInterpolateCompositePass with aten decompositions #64

Closed chunnienc closed 1 week ago

chunnienc commented 2 weeks ago

The issue does not break the current 0429 nightly dependencies. This is a fix for forward compatibility and future dependencies upgrade.

Starting from torch 2.5.0 nightly (after mid June 2024), torch.nn.functional.interpolate no longer gets decomposed right after export but exported to torch.ops.aten.upsample_nearest2d.vec and torch.ops.aten.upsample_bilinear2d.vec in the first step. This behavior breaks all our pattern matching composite builder.

The fix in this PR runs decompositions on patterns and exported model for these ops. A more stable future work would be relying on aten composite builder, instead of decomposing then pattern matching.

BUG=https://b.corp.google.com/issues/348413649