From 9a6c2a75b85fb8917e2e62e4df1cfa7263db3667 Mon Sep 17 00:00:00 2001 From: Jordan Fix Date: Wed, 8 Sep 2021 16:09:53 -0700 Subject: [PATCH] [acc_tracer] Enable check_mutable_operations (#64456) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64456 att Test Plan: CI Reviewed By: protonu Differential Revision: D30679174 fbshipit-source-id: 73f3a07d58380cd44fb3481aa97d463c0a964de8 --- torch/fx/experimental/fx_acc/acc_tracer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/torch/fx/experimental/fx_acc/acc_tracer.py b/torch/fx/experimental/fx_acc/acc_tracer.py index 1f6a365..21fade9 100644 --- a/torch/fx/experimental/fx_acc/acc_tracer.py +++ b/torch/fx/experimental/fx_acc/acc_tracer.py @@ -204,6 +204,9 @@ class ConditionalExceptionWrapper(nn.Module): # Custom tracer that traces to the functional level and rewrites asserts and # exceptions. class AccRewritingTracer(Tracer): + # Add an explicit check for mutable operations, which break symbolic tracing. + check_mutable_operations = True + # Note: Treat ConditionalExceptionWrapper as a leaf so that we don't # trace into it, because it contains control flow and raises an exception. DEFAULT_LEAF_MODULE_LIST = { -- 2.7.4