[DORT] Fix fake tensor problem cuased by PyTorch change (#15664)

This should make `Orttraining Linux Lazy Tensor CI Pipeline` green
again.
This commit is contained in:
Wei-Sheng Chin 2023-04-25 04:56:42 -07:00 committed by GitHub
parent 3440d3a08e
commit d0c3f92ec6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -627,7 +627,9 @@ class OrtBackend:
if graph_module in self._partitioner_cache:
partitioned_prim_graph_module = self._partitioner_cache[graph_module]
else:
prim_graph_module = make_fx(graph_module, decomposition_table=_ATEN2ATEN_DECOMP)(*args)
prim_graph_module = make_fx(
graph_module, tracing_mode="fake", _allow_non_fake_inputs=True, decomposition_table=_ATEN2ATEN_DECOMP
)(*args)
# TODO(wechi): this is required for removing aten::_to_copy in _replace_to_copy_with_to.
# We need input and output tensors' devices to decide if aten::_to_copy is just a Cast.
FakeTensorProp(prim_graph_module).propagate(*args)