ai-edge-torch-nightly 0.4.0.dev20250310__py3-none-any.whl → 0.4.0.dev20250311__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -82,6 +82,9 @@ _torch_library.ODML_TORCH_LIB.define(
82
82
 
83
83
  mark_tensor_op = torch.ops.odml_torch.mark_tensor.default
84
84
 
85
+ # Prevent composite inputs and outputs from being DCE'd during torch.export.
86
+ torch.fx.node.has_side_effect(mark_tensor_op)
87
+
85
88
 
86
89
  @torch.library.impl(
87
90
  _torch_library.ODML_TORCH_LIB, "mark_tensor", "CompositeExplicitAutograd"
@@ -41,8 +41,8 @@ class StableHLOCompositeBuilder:
41
41
  self.attr = attr
42
42
  self.name = name
43
43
  self.id = _get_uuid()
44
- self._inputs = []
45
- self._outputs = []
44
+ self._input_cnt = 0
45
+ self._output_cnt = 0
46
46
 
47
47
  def _mark_tensor(self, *tensors: torch.Tensor, is_input: bool):
48
48
  """Mark the input/output tensors of the StableHLO Composite."""
@@ -53,9 +53,20 @@ class StableHLOCompositeBuilder:
53
53
  else None
54
54
  )
55
55
 
56
- for pos, tensor in enumerate(tensors):
56
+ def _pos() -> int:
57
+ if is_input:
58
+ self._input_cnt += 1
59
+ return self._input_cnt - 1
60
+ else:
61
+ self._output_cnt += 1
62
+ return self._output_cnt - 1
63
+
64
+ for tensor in tensors:
57
65
  if not isinstance(tensor, torch.Tensor):
58
66
  raise ValueError(f"input must be a torch tensor. Got {type(tensor)}.")
67
+
68
+ pos = _pos()
69
+
59
70
  marked_tensors.append(
60
71
  mark_tensor.mark_tensor_op(
61
72
  tensor,
ai_edge_torch/version.py CHANGED
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- __version__ = "0.4.0.dev20250310"
16
+ __version__ = "0.4.0.dev20250311"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ai-edge-torch-nightly
3
- Version: 0.4.0.dev20250310
3
+ Version: 0.4.0.dev20250311
4
4
  Summary: Supporting PyTorch models with the Google AI Edge TFLite runtime.
5
5
  Home-page: https://github.com/google-ai-edge/ai-edge-torch
6
6
  Keywords: On-Device ML,AI,Google,TFLite,PyTorch,LLMs,GenAI
@@ -2,7 +2,7 @@ ai_edge_torch/__init__.py,sha256=8sPR_5uXJA4NEE0nIwNdSl-ADOJEoR8hAgYvBQDY70Y,120
2
2
  ai_edge_torch/_config.py,sha256=AiqhbcheF7j_ozIGDLC89k1we95aVgFDa-tR6h7UI0s,2529
3
3
  ai_edge_torch/conftest.py,sha256=r0GTrhMRhlmOGrrkvumHN8hkmyug6WvF60vWq8wRIBI,758
4
4
  ai_edge_torch/model.py,sha256=N-pNpTxzhaFGhWhnSGd70lBzb9VlEhTOq5mddU7bvvI,5542
5
- ai_edge_torch/version.py,sha256=rkRy3DyD2DornHefvbWznzVRjj0A3967fcNBIlVQEz8,706
5
+ ai_edge_torch/version.py,sha256=nA0GT6cYQD_gQdlYKHCiF75nDcTUgY4bU2Zti4BK2gI,706
6
6
  ai_edge_torch/_convert/__init__.py,sha256=hHLluseD2R0Hh4W6XZRIXY_dRQeYudjsrKGf6LZz65g,671
7
7
  ai_edge_torch/_convert/conversion.py,sha256=gpXQnifODU-mWxkUZw_3ov1lEYBw1SPVIcqj5k7pTGo,5550
8
8
  ai_edge_torch/_convert/conversion_utils.py,sha256=Sr8qXVcTwc-ZnZmK7yxVrIOOp1S_vNrwzC0zUvLTI2o,2160
@@ -205,8 +205,8 @@ ai_edge_torch/odml_torch/export.py,sha256=7l8R0DEq_vfns8iWpruMlIyaIKZAFzoAy369-7
205
205
  ai_edge_torch/odml_torch/export_utils.py,sha256=QeA37Irlty6AiIBuqmHmJgn3lqahBQ5xsh6IKRoKm1g,4774
206
206
  ai_edge_torch/odml_torch/tf_integration.py,sha256=NN29WeXmHZ0S1RPDFHUnBi2DEjMvAtwczStPYIsQ1w8,4849
207
207
  ai_edge_torch/odml_torch/composite/__init__.py,sha256=71GM_gDZxJyo38ZSoYSwhZX3xKA9rknO93JS9kw9w_c,778
208
- ai_edge_torch/odml_torch/composite/mark_tensor.py,sha256=U--rwl-XkWKgkdXCXDn6yySug8FR66o1YFUAIoSaWW4,3523
209
- ai_edge_torch/odml_torch/composite/stablehlo_composite_builder.py,sha256=2Y52E_gLeoXpMcPpV-svXsgN3JbEIjnPVjm0xkpTUdQ,3319
208
+ ai_edge_torch/odml_torch/composite/mark_tensor.py,sha256=yWMTkE0IESPUQyL20M6b_hv3VTptm9owC_evZcvoEMU,3647
209
+ ai_edge_torch/odml_torch/composite/stablehlo_composite_builder.py,sha256=h6DQkYVS4fnKMALIVdU6Q7J6Ehg3hMCV4C406SyIk3k,3513
210
210
  ai_edge_torch/odml_torch/debuginfo/__init__.py,sha256=3A_lMyj-B-DOhLJG6WmjKvZK5te2rXje8FrfqOhZsN0,959
211
211
  ai_edge_torch/odml_torch/debuginfo/_build.py,sha256=6Ns2rlfOilLJEk5cUxlkRwm2uxOgEF2-0S2DMcOqr6A,3319
212
212
  ai_edge_torch/odml_torch/debuginfo/_op_polyfill.py,sha256=IvOBQyROI9WHS3umHRxsDW-1YElU9BPWzKtJA2eKWOI,1739
@@ -233,8 +233,8 @@ ai_edge_torch/quantize/quant_config.py,sha256=U0KisSW-uZkoMJcy-ZP9W57p3tsa594fr9
233
233
  ai_edge_torch/testing/__init__.py,sha256=hHLluseD2R0Hh4W6XZRIXY_dRQeYudjsrKGf6LZz65g,671
234
234
  ai_edge_torch/testing/model_coverage/__init__.py,sha256=5P8J6Zk5YYtDvTBucFvB9NGSRI7Gw_24WnrbhXgycEE,765
235
235
  ai_edge_torch/testing/model_coverage/model_coverage.py,sha256=UPB448aMDUyC0HNYVqio2rcJPnDN0tBQMP08J6vPYew,4718
236
- ai_edge_torch_nightly-0.4.0.dev20250310.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
237
- ai_edge_torch_nightly-0.4.0.dev20250310.dist-info/METADATA,sha256=GXkTBv2DzWbm9p52gwaLQNl3iyKQ8qGK72is7Wy0gMM,1966
238
- ai_edge_torch_nightly-0.4.0.dev20250310.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
239
- ai_edge_torch_nightly-0.4.0.dev20250310.dist-info/top_level.txt,sha256=5KXRaF2hwkApYxf7Y8y_tVb9aulGTlbOoNdbx1aKRkE,14
240
- ai_edge_torch_nightly-0.4.0.dev20250310.dist-info/RECORD,,
236
+ ai_edge_torch_nightly-0.4.0.dev20250311.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
237
+ ai_edge_torch_nightly-0.4.0.dev20250311.dist-info/METADATA,sha256=jfoiraSEOCTVbZMoOK-4snxTq9ejUm43i5z1EuWKTLU,1966
238
+ ai_edge_torch_nightly-0.4.0.dev20250311.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
239
+ ai_edge_torch_nightly-0.4.0.dev20250311.dist-info/top_level.txt,sha256=5KXRaF2hwkApYxf7Y8y_tVb9aulGTlbOoNdbx1aKRkE,14
240
+ ai_edge_torch_nightly-0.4.0.dev20250311.dist-info/RECORD,,