Repository: pytorch
Issue: can't compile torchvision RPN with AOTInductor
Labels: triaged,oncall: pt2,module: dynamic shapes,oncall: export

### 🐛 Describe the bug

I try to compile an object detection model that uses torchvison's rpn module. it fails when generating anchors with `AssertionError: Mutating module attribute cell_anchors during export.` I think this is related to https://github.com/pytorch/pytorch/issues/108805

### Error logs

```python
I0301 19:15:52.323000 140521716340544 torch/fx/experimental/symbolic_shapes.py:1869] [0/0] create_env
I0301 19:15:52.435000 140521716340544 torch/fx/experimental/symbolic_shapes.py:2620] [0/0] create_symbol s0 = 2 for L['batch_tensor'].size()[0] [2, 13] (_dynamo/variables/builder.py:1791 in <lambda>)
V0301 19:15:52.437000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3914] [0/0] eval True == True [statically known]
V0301 19:15:52.437000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3914] [0/0] eval False == False [statically known]
V0301 19:15:52.537000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3914] [0/0] eval Eq(s0, 9223372036854775807) == False [statically known]
V0301 19:15:52.538000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3914] [0/0] eval False == False [statically known]
V0301 19:15:52.539000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3914] [0/0] eval s0 < 9223372036854775807 == True [statically known]
V0301 19:15:52.575000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3914] [0/0] eval Ne(s0, 1) == True [statically known]
V0301 19:15:52.592000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3914] [0/0] eval Eq(s0, 1) == False [statically known]
V0301 19:15:52.659000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3914] [0/0] eval True == True [statically known]
V0301 19:16:11.974000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3914] [0/0] eval Eq(3*s0, 3) == False [statically known]
V0301 19:16:11.975000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3914] [0/0] eval Ne(3*s0, 3) == True [statically known]
I0301 19:16:12.160000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3622] [0/0] set_replacement s0 = 2 (solve_backed) ValueRanges(lower=2, upper=2, is_bool=False)
I0301 19:16:12.162000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3622] [0/0] set_replacement s0 = 2 (find) ValueRanges(lower=2, upper=2, is_bool=False)
I0301 19:16:12.163000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3832] [0/0] eval Eq(s0, 2) [guard added] at torchvision/models/detection/transform.py:243 in batch_images (_dynamo/variables/tensor.py:892 in evaluate_expr)
V0301 19:16:12.171000 140521716340544 torch/fx/experimental/symbolic_shapes.py:3902] [0/0] eval 2 [trivial]
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[2], line 15
     12 width_dim = torch.export.Dim("width")
     14 if not os.path.exists(model_path):
---> 15     so_path = torch._export.aot_compile(
     16         f = model,
     17         args = (x, ),
     18         # Specify the first dimension of the input x as dynamic
     19         dynamic_shapes={"batch_tensor": {0: batch_dim}},
     20         # Specify the generated shared library path
     21         options={
     22             "aot_inductor.output_path": model_path,
     23             "max_autotune": True,
     24         },
     25     )

File /opt/conda/lib/python3.10/site-packages/torch/_export/__init__.py:382, in aot_compile(f, args, kwargs, constraints, dynamic_shapes, options, remove_runtime_assertions, disable_constraint_solver)
    378     gm = torch.export._trace._export(f, args, kwargs, constraints, pre_dispatch=True).module()
    379 else:
    380     # We want to export to Torch IR here to utilize the pre_grad passes in
    381     # inductor, which run on Torch IR.
--> 382     gm = _export_to_torch_ir(
    383         f,
    384         args,
    385         kwargs,
    386         constraints,
    387         disable_constraint_solver=disable_constraint_solver,
    388         # Disabling this flag, because instead we can rely on the mapping
    389         # dynamo_flat_name_to_original_fqn which is coming from Dynamo.
    390         restore_fqn=False,
    391     )
    392 flat_example_inputs = pytree.arg_tree_leaves(*args, **(kwargs or {}))
    394 with torch.no_grad():

File /opt/conda/lib/python3.10/site-packages/torch/export/_trace.py:320, in _export_to_torch_ir(f, args, kwargs, constraints, preserve_module_call_signature, disable_constraint_solver, restore_fqn, _log_export_usage)
    316     module_call_specs: Dict[str, Dict[str, pytree.TreeSpec]] = {}
    317     with _wrap_submodules(
    318         f, preserve_module_call_signature, module_call_specs
    319     ), _ignore_backend_decomps():
--> 320         gm_torch_level, _ = torch._dynamo.export(
    321             f,
    322             constraints=constraints,
    323             assume_static_by_default=True,
    324             tracing_mode="symbolic",
    325             disable_constraint_solver=disable_constraint_solver,
    326             _log_export_usage=_log_export_usage,
    327         )(
    328             *args,
    329             **kwargs,
    330         )
    331 except (ConstraintViolationError, ValueRangeError) as e:
    332     raise UserError(UserErrorType.CONSTRAINT_VIOLATION, str(e))  # noqa: TRY200

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py:1314, in export.<locals>.inner(*args, **kwargs)
   1312 # TODO(voz): We may have instances of `f` that mutate inputs, we should track sideeffects and reject.
   1313 try:
-> 1314     result_traced = opt_f(*args, **kwargs)
   1315 except ConstraintViolationError as e:
   1316     constraint_violation_error = e

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py:1529, in Module._wrapped_call_impl(self, *args, **kwargs)
   1527     return self._compiled_call_impl(*args, **kwargs)  # type: ignore[misc]
   1528 else:
-> 1529     return self._call_impl(*args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py:1538, in Module._call_impl(self, *args, **kwargs)
   1533 # If we don't have any hooks, we want to skip the rest of the logic in
   1534 # this function, and just call forward.
   1535 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
   1536         or _global_backward_pre_hooks or _global_backward_hooks
   1537         or _global_forward_hooks or _global_forward_pre_hooks):
-> 1538     return forward_call(*args, **kwargs)
   1540 try:
   1541     result = None

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/eval_frame.py:455, in _TorchDynamoContext.__call__.<locals>._fn(*args, **kwargs)
    453 prior = set_eval_frame(callback)
    454 try:
--> 455     return fn(*args, **kwargs)
    456 finally:
    457     set_eval_frame(prior)

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py:1529, in Module._wrapped_call_impl(self, *args, **kwargs)
   1527     return self._compiled_call_impl(*args, **kwargs)  # type: ignore[misc]
   1528 else:
-> 1529     return self._call_impl(*args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py:1538, in Module._call_impl(self, *args, **kwargs)
   1533 # If we don't have any hooks, we want to skip the rest of the logic in
   1534 # this function, and just call forward.
   1535 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
   1536         or _global_backward_pre_hooks or _global_backward_hooks
   1537         or _global_forward_hooks or _global_forward_pre_hooks):
-> 1538     return forward_call(*args, **kwargs)
   1540 try:
   1541     result = None

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:912, in catch_errors_wrapper.<locals>.catch_errors(frame, cache_entry, frame_state)
    908             return hijacked_callback(frame, cache_entry, hooks, frame_state)
    910 with compile_lock, _disable_current_modes():
    911     # skip=1: skip this frame
--> 912     return callback(frame, cache_entry, hooks, frame_state, skip=1)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:398, in convert_frame_assert.<locals>._convert_frame_assert(frame, cache_entry, hooks, frame_state, skip)
    384 compile_id = CompileId(frame_id, frame_compile_id)
    386 signpost_event(
    387     "dynamo",
    388     "_convert_frame_assert._compile",
   (...)
    395     },
    396 )
--> 398 return _compile(
    399     frame.f_code,
    400     frame.f_globals,
    401     frame.f_locals,
    402     frame.f_builtins,
    403     compiler_fn,
    404     one_graph,
    405     export,
    406     export_constraints,
    407     hooks,
    408     cache_size,
    409     frame,
    410     frame_state=frame_state,
    411     compile_id=compile_id,
    412     skip=skip + 1,
    413 )

File /opt/conda/lib/python3.10/contextlib.py:79, in ContextDecorator.__call__.<locals>.inner(*args, **kwds)
     76 @wraps(func)
     77 def inner(*args, **kwds):
     78     with self._recreate_cm():
---> 79         return func(*args, **kwds)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:669, in _compile(code, globals, locals, builtins, compiler_fn, one_graph, export, export_constraints, hooks, cache_size, frame, frame_state, compile_id, skip)
    659 log.debug(
    660     "torchdynamo start compiling %s %s:%s, stack (elided %s frames):\n%s",
    661     code.co_name,
   (...)
    666     "".join(traceback.format_list(traceback.extract_stack()[: -2 - skip])),
    667 )
    668 try:
--> 669     guarded_code = compile_inner(code, one_graph, hooks, transform)
    670     return guarded_code
    671 except (
    672     Unsupported,
    673     TorchRuntimeError,
   (...)
    680     BisectValidationException,
    681 ) as e:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/utils.py:256, in dynamo_timed.<locals>.dynamo_timed_inner.<locals>.time_wrapper(*args, **kwargs)
    254 with torch.profiler.record_function(f"{key} (dynamo_timed)"):
    255     t0 = time.time()
--> 256     r = func(*args, **kwargs)
    257     time_spent = time.time() - t0
    258 compilation_time_metrics[key].append(time_spent)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:542, in _compile.<locals>.compile_inner(code, one_graph, hooks, transform)
    540 CompileContext.get().attempt = attempt
    541 try:
--> 542     out_code = transform_code_object(code, transform)
    543     break
    544 except exc.RestartAnalysis as e:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/bytecode_transformation.py:1033, in transform_code_object(code, transformations, safe)
   1030 instructions = cleaned_instructions(code, safe)
   1031 propagate_line_nums(instructions)
-> 1033 transformations(instructions, code_options)
   1034 return clean_and_assemble_instructions(instructions, keys, code_options)[1]

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:163, in preserve_global_state.<locals>._fn(*args, **kwargs)
    161 cleanup = setup_compile_debug()
    162 try:
--> 163     return fn(*args, **kwargs)
    164 finally:
    165     cleanup.close()

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py:507, in _compile.<locals>.transform(instructions, code_options)
    505 try:
    506     with tracing(tracer.output.tracing_context), tracer.set_current_tx():
--> 507         tracer.run()
    508 except exc.UnspecializeRestartAnalysis:
    509     speculation_log.clear()

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2130, in InstructionTranslator.run(self)
   2129 def run(self):
-> 2130     super().run()

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:793, in InstructionTranslatorBase.run(self)
    788 try:
    789     self.output.push_tx(self)
    790     while (
    791         self.instruction_pointer is not None
    792         and not self.output.should_exit
--> 793         and self.step()
    794     ):
    795         pass
    796 except BackendCompilerFailed:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:756, in InstructionTranslatorBase.step(self)
    752         unimplemented(f"missing: {inst.opname}")
    753     TracingContext.set_current_loc(
    754         self.f_code.co_filename, self.lineno, self.f_code.co_name
    755     )
--> 756     getattr(self, inst.opname)(inst)
    758     return inst.opname != "RETURN_VALUE"
    759 except Unsupported:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:470, in break_graph_if_unsupported.<locals>.decorator.<locals>.wrapper(self, inst)
    466 try:
    467     TracingContext.set_current_loc(
    468         self.f_code.co_filename, self.lineno, self.f_code.co_name
    469     )
--> 470     return inner_fn(self, inst)
    471 except Unsupported as excp:
    472     if self.generic_context_manager_depth > 0:
    473         # We don't support graph break under GenericContextWrappingVariable,
    474         # If there is, we roll back to the checkpoint and fall back.

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1202, in InstructionTranslatorBase.CALL_FUNCTION(self, inst)
   1200 args = self.popn(inst.argval)
   1201 fn = self.pop()
-> 1202 self.call_function(fn, args, {})

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:657, in InstructionTranslatorBase.call_function(self, fn, args, kwargs)
    655 if inner_fn and callable(inner_fn) and is_forbidden(inner_fn):
    656     raise AssertionError(f"Attempt to trace forbidden callable {inner_fn}")
--> 657 self.push(fn.call_function(self, args, kwargs))

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/nn_module.py:336, in NNModuleVariable.call_function(self, tx, args, kwargs)
    334 else:
    335     assert istype(fn, types.FunctionType)
--> 336 return tx.inline_user_function_return(
    337     variables.UserFunctionVariable(fn, source=fn_source),
    338     args,
    339     kwargs,
    340 )

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:663, in InstructionTranslatorBase.inline_user_function_return(self, fn, args, kwargs)
    659 def inline_user_function_return(self, fn, args, kwargs):
    660     """
    661     A call to some user defined function by inlining it.
    662     """
--> 663     return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2266, in InliningInstructionTranslator.inline_call(cls, parent, func, args, kwargs)
   2263 @classmethod
   2264 def inline_call(cls, parent, func, args, kwargs):
   2265     with patch.dict(counters, {"unimplemented": counters["inline_call"]}):
-> 2266         return cls.inline_call_(parent, func, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2380, in InliningInstructionTranslator.inline_call_(parent, func, args, kwargs)
   2378 try:
   2379     with strict_ctx:
-> 2380         tracer.run()
   2381 except exc.SkipFrame as e:
   2382     msg = f"SKIPPED INLINING {code}: {e}"

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:793, in InstructionTranslatorBase.run(self)
    788 try:
    789     self.output.push_tx(self)
    790     while (
    791         self.instruction_pointer is not None
    792         and not self.output.should_exit
--> 793         and self.step()
    794     ):
    795         pass
    796 except BackendCompilerFailed:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:756, in InstructionTranslatorBase.step(self)
    752         unimplemented(f"missing: {inst.opname}")
    753     TracingContext.set_current_loc(
    754         self.f_code.co_filename, self.lineno, self.f_code.co_name
    755     )
--> 756     getattr(self, inst.opname)(inst)
    758     return inst.opname != "RETURN_VALUE"
    759 except Unsupported:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:470, in break_graph_if_unsupported.<locals>.decorator.<locals>.wrapper(self, inst)
    466 try:
    467     TracingContext.set_current_loc(
    468         self.f_code.co_filename, self.lineno, self.f_code.co_name
    469     )
--> 470     return inner_fn(self, inst)
    471 except Unsupported as excp:
    472     if self.generic_context_manager_depth > 0:
    473         # We don't support graph break under GenericContextWrappingVariable,
    474         # If there is, we roll back to the checkpoint and fall back.

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1243, in InstructionTranslatorBase.CALL_FUNCTION_EX(self, inst)
   1241 # Map to a dictionary of str -> VariableTracker
   1242 kwargsvars = kwargsvars.keys_as_python_constant()
-> 1243 self.call_function(fn, argsvars.items, kwargsvars)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:657, in InstructionTranslatorBase.call_function(self, fn, args, kwargs)
    655 if inner_fn and callable(inner_fn) and is_forbidden(inner_fn):
    656     raise AssertionError(f"Attempt to trace forbidden callable {inner_fn}")
--> 657 self.push(fn.call_function(self, args, kwargs))

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:334, in UserMethodVariable.call_function(self, tx, args, kwargs)
    326     if (
    327         module_attr is not None
    328         and module_attr.startswith("torch.nn.")
    329         or self.is_constant
    330     ):
    331         return self.obj.call_method(
    332             tx, self.fn.__name__, args, kwargs, constant=self.is_constant
    333         )
--> 334 return super().call_function(tx, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:288, in UserFunctionVariable.call_function(self, tx, args, kwargs)
    283 if self.is_constant:
    284     return invoke_and_store_as_constant(
    285         tx, self.fn, self.get_name(), args, kwargs
    286     )
--> 288 return super().call_function(tx, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:89, in BaseUserFunctionVariable.call_function(self, tx, args, kwargs)
     86 def call_function(
     87     self, tx, args: "List[VariableTracker]", kwargs: "Dict[str, VariableTracker]"
     88 ) -> "VariableTracker":
---> 89     return tx.inline_user_function_return(
     90         self, list(self.self_args()) + list(args), kwargs
     91     )

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:663, in InstructionTranslatorBase.inline_user_function_return(self, fn, args, kwargs)
    659 def inline_user_function_return(self, fn, args, kwargs):
    660     """
    661     A call to some user defined function by inlining it.
    662     """
--> 663     return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2266, in InliningInstructionTranslator.inline_call(cls, parent, func, args, kwargs)
   2263 @classmethod
   2264 def inline_call(cls, parent, func, args, kwargs):
   2265     with patch.dict(counters, {"unimplemented": counters["inline_call"]}):
-> 2266         return cls.inline_call_(parent, func, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2380, in InliningInstructionTranslator.inline_call_(parent, func, args, kwargs)
   2378 try:
   2379     with strict_ctx:
-> 2380         tracer.run()
   2381 except exc.SkipFrame as e:
   2382     msg = f"SKIPPED INLINING {code}: {e}"

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:793, in InstructionTranslatorBase.run(self)
    788 try:
    789     self.output.push_tx(self)
    790     while (
    791         self.instruction_pointer is not None
    792         and not self.output.should_exit
--> 793         and self.step()
    794     ):
    795         pass
    796 except BackendCompilerFailed:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:756, in InstructionTranslatorBase.step(self)
    752         unimplemented(f"missing: {inst.opname}")
    753     TracingContext.set_current_loc(
    754         self.f_code.co_filename, self.lineno, self.f_code.co_name
    755     )
--> 756     getattr(self, inst.opname)(inst)
    758     return inst.opname != "RETURN_VALUE"
    759 except Unsupported:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:470, in break_graph_if_unsupported.<locals>.decorator.<locals>.wrapper(self, inst)
    466 try:
    467     TracingContext.set_current_loc(
    468         self.f_code.co_filename, self.lineno, self.f_code.co_name
    469     )
--> 470     return inner_fn(self, inst)
    471 except Unsupported as excp:
    472     if self.generic_context_manager_depth > 0:
    473         # We don't support graph break under GenericContextWrappingVariable,
    474         # If there is, we roll back to the checkpoint and fall back.

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1202, in InstructionTranslatorBase.CALL_FUNCTION(self, inst)
   1200 args = self.popn(inst.argval)
   1201 fn = self.pop()
-> 1202 self.call_function(fn, args, {})

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:657, in InstructionTranslatorBase.call_function(self, fn, args, kwargs)
    655 if inner_fn and callable(inner_fn) and is_forbidden(inner_fn):
    656     raise AssertionError(f"Attempt to trace forbidden callable {inner_fn}")
--> 657 self.push(fn.call_function(self, args, kwargs))

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/nn_module.py:336, in NNModuleVariable.call_function(self, tx, args, kwargs)
    334 else:
    335     assert istype(fn, types.FunctionType)
--> 336 return tx.inline_user_function_return(
    337     variables.UserFunctionVariable(fn, source=fn_source),
    338     args,
    339     kwargs,
    340 )

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:663, in InstructionTranslatorBase.inline_user_function_return(self, fn, args, kwargs)
    659 def inline_user_function_return(self, fn, args, kwargs):
    660     """
    661     A call to some user defined function by inlining it.
    662     """
--> 663     return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2266, in InliningInstructionTranslator.inline_call(cls, parent, func, args, kwargs)
   2263 @classmethod
   2264 def inline_call(cls, parent, func, args, kwargs):
   2265     with patch.dict(counters, {"unimplemented": counters["inline_call"]}):
-> 2266         return cls.inline_call_(parent, func, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2380, in InliningInstructionTranslator.inline_call_(parent, func, args, kwargs)
   2378 try:
   2379     with strict_ctx:
-> 2380         tracer.run()
   2381 except exc.SkipFrame as e:
   2382     msg = f"SKIPPED INLINING {code}: {e}"

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:793, in InstructionTranslatorBase.run(self)
    788 try:
    789     self.output.push_tx(self)
    790     while (
    791         self.instruction_pointer is not None
    792         and not self.output.should_exit
--> 793         and self.step()
    794     ):
    795         pass
    796 except BackendCompilerFailed:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:756, in InstructionTranslatorBase.step(self)
    752         unimplemented(f"missing: {inst.opname}")
    753     TracingContext.set_current_loc(
    754         self.f_code.co_filename, self.lineno, self.f_code.co_name
    755     )
--> 756     getattr(self, inst.opname)(inst)
    758     return inst.opname != "RETURN_VALUE"
    759 except Unsupported:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:470, in break_graph_if_unsupported.<locals>.decorator.<locals>.wrapper(self, inst)
    466 try:
    467     TracingContext.set_current_loc(
    468         self.f_code.co_filename, self.lineno, self.f_code.co_name
    469     )
--> 470     return inner_fn(self, inst)
    471 except Unsupported as excp:
    472     if self.generic_context_manager_depth > 0:
    473         # We don't support graph break under GenericContextWrappingVariable,
    474         # If there is, we roll back to the checkpoint and fall back.

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1243, in InstructionTranslatorBase.CALL_FUNCTION_EX(self, inst)
   1241 # Map to a dictionary of str -> VariableTracker
   1242 kwargsvars = kwargsvars.keys_as_python_constant()
-> 1243 self.call_function(fn, argsvars.items, kwargsvars)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:657, in InstructionTranslatorBase.call_function(self, fn, args, kwargs)
    655 if inner_fn and callable(inner_fn) and is_forbidden(inner_fn):
    656     raise AssertionError(f"Attempt to trace forbidden callable {inner_fn}")
--> 657 self.push(fn.call_function(self, args, kwargs))

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:334, in UserMethodVariable.call_function(self, tx, args, kwargs)
    326     if (
    327         module_attr is not None
    328         and module_attr.startswith("torch.nn.")
    329         or self.is_constant
    330     ):
    331         return self.obj.call_method(
    332             tx, self.fn.__name__, args, kwargs, constant=self.is_constant
    333         )
--> 334 return super().call_function(tx, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:288, in UserFunctionVariable.call_function(self, tx, args, kwargs)
    283 if self.is_constant:
    284     return invoke_and_store_as_constant(
    285         tx, self.fn, self.get_name(), args, kwargs
    286     )
--> 288 return super().call_function(tx, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:89, in BaseUserFunctionVariable.call_function(self, tx, args, kwargs)
     86 def call_function(
     87     self, tx, args: "List[VariableTracker]", kwargs: "Dict[str, VariableTracker]"
     88 ) -> "VariableTracker":
---> 89     return tx.inline_user_function_return(
     90         self, list(self.self_args()) + list(args), kwargs
     91     )

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:663, in InstructionTranslatorBase.inline_user_function_return(self, fn, args, kwargs)
    659 def inline_user_function_return(self, fn, args, kwargs):
    660     """
    661     A call to some user defined function by inlining it.
    662     """
--> 663     return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2266, in InliningInstructionTranslator.inline_call(cls, parent, func, args, kwargs)
   2263 @classmethod
   2264 def inline_call(cls, parent, func, args, kwargs):
   2265     with patch.dict(counters, {"unimplemented": counters["inline_call"]}):
-> 2266         return cls.inline_call_(parent, func, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2380, in InliningInstructionTranslator.inline_call_(parent, func, args, kwargs)
   2378 try:
   2379     with strict_ctx:
-> 2380         tracer.run()
   2381 except exc.SkipFrame as e:
   2382     msg = f"SKIPPED INLINING {code}: {e}"

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:793, in InstructionTranslatorBase.run(self)
    788 try:
    789     self.output.push_tx(self)
    790     while (
    791         self.instruction_pointer is not None
    792         and not self.output.should_exit
--> 793         and self.step()
    794     ):
    795         pass
    796 except BackendCompilerFailed:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:756, in InstructionTranslatorBase.step(self)
    752         unimplemented(f"missing: {inst.opname}")
    753     TracingContext.set_current_loc(
    754         self.f_code.co_filename, self.lineno, self.f_code.co_name
    755     )
--> 756     getattr(self, inst.opname)(inst)
    758     return inst.opname != "RETURN_VALUE"
    759 except Unsupported:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:470, in break_graph_if_unsupported.<locals>.decorator.<locals>.wrapper(self, inst)
    466 try:
    467     TracingContext.set_current_loc(
    468         self.f_code.co_filename, self.lineno, self.f_code.co_name
    469     )
--> 470     return inner_fn(self, inst)
    471 except Unsupported as excp:
    472     if self.generic_context_manager_depth > 0:
    473         # We don't support graph break under GenericContextWrappingVariable,
    474         # If there is, we roll back to the checkpoint and fall back.

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1202, in InstructionTranslatorBase.CALL_FUNCTION(self, inst)
   1200 args = self.popn(inst.argval)
   1201 fn = self.pop()
-> 1202 self.call_function(fn, args, {})

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:657, in InstructionTranslatorBase.call_function(self, fn, args, kwargs)
    655 if inner_fn and callable(inner_fn) and is_forbidden(inner_fn):
    656     raise AssertionError(f"Attempt to trace forbidden callable {inner_fn}")
--> 657 self.push(fn.call_function(self, args, kwargs))

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/nn_module.py:336, in NNModuleVariable.call_function(self, tx, args, kwargs)
    334 else:
    335     assert istype(fn, types.FunctionType)
--> 336 return tx.inline_user_function_return(
    337     variables.UserFunctionVariable(fn, source=fn_source),
    338     args,
    339     kwargs,
    340 )

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:663, in InstructionTranslatorBase.inline_user_function_return(self, fn, args, kwargs)
    659 def inline_user_function_return(self, fn, args, kwargs):
    660     """
    661     A call to some user defined function by inlining it.
    662     """
--> 663     return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2266, in InliningInstructionTranslator.inline_call(cls, parent, func, args, kwargs)
   2263 @classmethod
   2264 def inline_call(cls, parent, func, args, kwargs):
   2265     with patch.dict(counters, {"unimplemented": counters["inline_call"]}):
-> 2266         return cls.inline_call_(parent, func, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2380, in InliningInstructionTranslator.inline_call_(parent, func, args, kwargs)
   2378 try:
   2379     with strict_ctx:
-> 2380         tracer.run()
   2381 except exc.SkipFrame as e:
   2382     msg = f"SKIPPED INLINING {code}: {e}"

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:793, in InstructionTranslatorBase.run(self)
    788 try:
    789     self.output.push_tx(self)
    790     while (
    791         self.instruction_pointer is not None
    792         and not self.output.should_exit
--> 793         and self.step()
    794     ):
    795         pass
    796 except BackendCompilerFailed:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:756, in InstructionTranslatorBase.step(self)
    752         unimplemented(f"missing: {inst.opname}")
    753     TracingContext.set_current_loc(
    754         self.f_code.co_filename, self.lineno, self.f_code.co_name
    755     )
--> 756     getattr(self, inst.opname)(inst)
    758     return inst.opname != "RETURN_VALUE"
    759 except Unsupported:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:470, in break_graph_if_unsupported.<locals>.decorator.<locals>.wrapper(self, inst)
    466 try:
    467     TracingContext.set_current_loc(
    468         self.f_code.co_filename, self.lineno, self.f_code.co_name
    469     )
--> 470     return inner_fn(self, inst)
    471 except Unsupported as excp:
    472     if self.generic_context_manager_depth > 0:
    473         # We don't support graph break under GenericContextWrappingVariable,
    474         # If there is, we roll back to the checkpoint and fall back.

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1243, in InstructionTranslatorBase.CALL_FUNCTION_EX(self, inst)
   1241 # Map to a dictionary of str -> VariableTracker
   1242 kwargsvars = kwargsvars.keys_as_python_constant()
-> 1243 self.call_function(fn, argsvars.items, kwargsvars)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:657, in InstructionTranslatorBase.call_function(self, fn, args, kwargs)
    655 if inner_fn and callable(inner_fn) and is_forbidden(inner_fn):
    656     raise AssertionError(f"Attempt to trace forbidden callable {inner_fn}")
--> 657 self.push(fn.call_function(self, args, kwargs))

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:334, in UserMethodVariable.call_function(self, tx, args, kwargs)
    326     if (
    327         module_attr is not None
    328         and module_attr.startswith("torch.nn.")
    329         or self.is_constant
    330     ):
    331         return self.obj.call_method(
    332             tx, self.fn.__name__, args, kwargs, constant=self.is_constant
    333         )
--> 334 return super().call_function(tx, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:288, in UserFunctionVariable.call_function(self, tx, args, kwargs)
    283 if self.is_constant:
    284     return invoke_and_store_as_constant(
    285         tx, self.fn, self.get_name(), args, kwargs
    286     )
--> 288 return super().call_function(tx, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:89, in BaseUserFunctionVariable.call_function(self, tx, args, kwargs)
     86 def call_function(
     87     self, tx, args: "List[VariableTracker]", kwargs: "Dict[str, VariableTracker]"
     88 ) -> "VariableTracker":
---> 89     return tx.inline_user_function_return(
     90         self, list(self.self_args()) + list(args), kwargs
     91     )

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:663, in InstructionTranslatorBase.inline_user_function_return(self, fn, args, kwargs)
    659 def inline_user_function_return(self, fn, args, kwargs):
    660     """
    661     A call to some user defined function by inlining it.
    662     """
--> 663     return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2266, in InliningInstructionTranslator.inline_call(cls, parent, func, args, kwargs)
   2263 @classmethod
   2264 def inline_call(cls, parent, func, args, kwargs):
   2265     with patch.dict(counters, {"unimplemented": counters["inline_call"]}):
-> 2266         return cls.inline_call_(parent, func, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2380, in InliningInstructionTranslator.inline_call_(parent, func, args, kwargs)
   2378 try:
   2379     with strict_ctx:
-> 2380         tracer.run()
   2381 except exc.SkipFrame as e:
   2382     msg = f"SKIPPED INLINING {code}: {e}"

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:793, in InstructionTranslatorBase.run(self)
    788 try:
    789     self.output.push_tx(self)
    790     while (
    791         self.instruction_pointer is not None
    792         and not self.output.should_exit
--> 793         and self.step()
    794     ):
    795         pass
    796 except BackendCompilerFailed:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:756, in InstructionTranslatorBase.step(self)
    752         unimplemented(f"missing: {inst.opname}")
    753     TracingContext.set_current_loc(
    754         self.f_code.co_filename, self.lineno, self.f_code.co_name
    755     )
--> 756     getattr(self, inst.opname)(inst)
    758     return inst.opname != "RETURN_VALUE"
    759 except Unsupported:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:470, in break_graph_if_unsupported.<locals>.decorator.<locals>.wrapper(self, inst)
    466 try:
    467     TracingContext.set_current_loc(
    468         self.f_code.co_filename, self.lineno, self.f_code.co_name
    469     )
--> 470     return inner_fn(self, inst)
    471 except Unsupported as excp:
    472     if self.generic_context_manager_depth > 0:
    473         # We don't support graph break under GenericContextWrappingVariable,
    474         # If there is, we roll back to the checkpoint and fall back.

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1202, in InstructionTranslatorBase.CALL_FUNCTION(self, inst)
   1200 args = self.popn(inst.argval)
   1201 fn = self.pop()
-> 1202 self.call_function(fn, args, {})

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:657, in InstructionTranslatorBase.call_function(self, fn, args, kwargs)
    655 if inner_fn and callable(inner_fn) and is_forbidden(inner_fn):
    656     raise AssertionError(f"Attempt to trace forbidden callable {inner_fn}")
--> 657 self.push(fn.call_function(self, args, kwargs))

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:334, in UserMethodVariable.call_function(self, tx, args, kwargs)
    326     if (
    327         module_attr is not None
    328         and module_attr.startswith("torch.nn.")
    329         or self.is_constant
    330     ):
    331         return self.obj.call_method(
    332             tx, self.fn.__name__, args, kwargs, constant=self.is_constant
    333         )
--> 334 return super().call_function(tx, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:288, in UserFunctionVariable.call_function(self, tx, args, kwargs)
    283 if self.is_constant:
    284     return invoke_and_store_as_constant(
    285         tx, self.fn, self.get_name(), args, kwargs
    286     )
--> 288 return super().call_function(tx, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/variables/functions.py:89, in BaseUserFunctionVariable.call_function(self, tx, args, kwargs)
     86 def call_function(
     87     self, tx, args: "List[VariableTracker]", kwargs: "Dict[str, VariableTracker]"
     88 ) -> "VariableTracker":
---> 89     return tx.inline_user_function_return(
     90         self, list(self.self_args()) + list(args), kwargs
     91     )

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:663, in InstructionTranslatorBase.inline_user_function_return(self, fn, args, kwargs)
    659 def inline_user_function_return(self, fn, args, kwargs):
    660     """
    661     A call to some user defined function by inlining it.
    662     """
--> 663     return InliningInstructionTranslator.inline_call(self, fn, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2266, in InliningInstructionTranslator.inline_call(cls, parent, func, args, kwargs)
   2263 @classmethod
   2264 def inline_call(cls, parent, func, args, kwargs):
   2265     with patch.dict(counters, {"unimplemented": counters["inline_call"]}):
-> 2266         return cls.inline_call_(parent, func, args, kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:2380, in InliningInstructionTranslator.inline_call_(parent, func, args, kwargs)
   2378 try:
   2379     with strict_ctx:
-> 2380         tracer.run()
   2381 except exc.SkipFrame as e:
   2382     msg = f"SKIPPED INLINING {code}: {e}"

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:793, in InstructionTranslatorBase.run(self)
    788 try:
    789     self.output.push_tx(self)
    790     while (
    791         self.instruction_pointer is not None
    792         and not self.output.should_exit
--> 793         and self.step()
    794     ):
    795         pass
    796 except BackendCompilerFailed:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:756, in InstructionTranslatorBase.step(self)
    752         unimplemented(f"missing: {inst.opname}")
    753     TracingContext.set_current_loc(
    754         self.f_code.co_filename, self.lineno, self.f_code.co_name
    755     )
--> 756     getattr(self, inst.opname)(inst)
    758     return inst.opname != "RETURN_VALUE"
    759 except Unsupported:

File /opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py:1308, in InstructionTranslatorBase.STORE_ATTR(self, inst)
   1303 val, obj = self.popn(2)
   1305 if isinstance(obj, NNModuleVariable):
   1306     # We don't allow side effects during export
   1307     # https://github.com/pytorch/torchdynamo/issues/1475
-> 1308     assert (
   1309         not self.export
   1310     ), f"Mutating module attribute {inst.argval} during export."
   1312 try:
   1313     BuiltinVariable(setattr).call_function(
   1314         self, [obj, ConstantVariable.create(inst.argval), val], {}
   1315     )

AssertionError: Mutating module attribute cell_anchors during export.

from user code:
   File "/opt/workspace/./satlas-src/satlas/model/model.py", line 841, in forward
    cur_outputs, _ = head(batch_tensor, features)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1538, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/workspace/[./satlas-src/satlas/model/model.py", line 531](http://127.0.0.1:8888/lab/tree/satlas-src/satlas/model/model.py#line=530), in forward
    proposals, proposal_losses = self.rpn(images, features, targets)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1538, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/rpn.py", line 362, in forward
    anchors = self.anchor_generator(images, features)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1538, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/anchor_utils.py", line 126, in forward
    self.set_cell_anchors(dtype, device)
  File "/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/anchor_utils.py", line 77, in set_cell_anchors
    self.cell_anchors = [cell_anchor.to(dtype=dtype, device=device) for cell_anchor in self.cell_anchors]
```

### Minified repro

os.environ["TORCH_DYNAMO_REPRO_AFTER"] = "aot" doesn't seem to do anything. after I run the code, the traceback is the same.

a minimal repro is to do

```python
import torch
import torch._dynamo as torchdynamo
from torchvision.models.detection import (
    maskrcnn_resnet50_fpn,
)

import torch._dynamo.config

#torch._dynamo.config.capture_scalar_outputs = True


net = maskrcnn_resnet50_fpn()
net.eval()
# Single input which is a list of images.
images = [torch.rand(3, 16, 16)]
# Double-check that the inputs work for the normal net.
net(images)
torch._dynamo.export(net, images, tracing_mode="symbolic", aten_graph=True)

```

```python
AssertionError: Mutating module attribute cell_anchors during export.

from user code:
   File "/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/generalized_rcnn.py", line 104, in forward
    proposals, proposal_losses = self.rpn(images, features, targets)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1538, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/rpn.py", line 362, in forward
    anchors = self.anchor_generator(images, features)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1538, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/anchor_utils.py", line 126, in forward
    self.set_cell_anchors(dtype, device)
  File "/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/anchor_utils.py", line 77, in set_cell_anchors
    self.cell_anchors = [cell_anchor.to(dtype=dtype, device=device) for cell_anchor in self.cell_anchors]

Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information
```

from the test script here: https://docs.google.com/document/d/159NTQQhz8ovIBxbQvGQ-fZ10pF9e2RPXm1JZYqdEzt4/edit from this issue https://github.com/pytorch/pytorch/issues/108805


### Versions

```
PyTorch version: 2.3.0.dev20240221
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.3 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.26.4
Libc version: glibc-2.35

Python version: 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.5.0-21-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.1.105
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3090
Nvidia driver version: 535.161.07
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      39 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             12
On-line CPU(s) list:                0-11
Vendor ID:                          GenuineIntel
Model name:                         Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
CPU family:                         6
Model:                              158
Thread(s) per core:                 2
Core(s) per socket:                 6
Socket(s):                          1
Stepping:                           10
CPU max MHz:                        4600.0000
CPU min MHz:                        800.0000
BogoMIPS:                           6399.96
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
Virtualization:                     VT-x
L1d cache:                          192 KiB (6 instances)
L1i cache:                          192 KiB (6 instances)
L2 cache:                           1.5 MiB (6 instances)
L3 cache:                           12 MiB (1 instance)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-11
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit:        KVM: Mitigation: VMX disabled
Vulnerability L1tf:                 Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds:                  Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:             Mitigation; PTI
Vulnerability Mmio stale data:      Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed:             Mitigation; IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; IBRS, IBPB conditional, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:                Mitigation; Microcode
Vulnerability Tsx async abort:      Mitigation; TSX disabled

Versions of relevant libraries:
[pip3] flake8==5.0.4
[pip3] mypy==1.0.1
[pip3] mypy-extensions==0.4.4
[pip3] numpy==1.26.4
[pip3] optree==0.10.0
[pip3] torch==2.3.0.dev20240221
[pip3] torchaudio==2.2.0.dev20240221
[pip3] torchelastic==0.2.2
[pip3] torchvision==0.18.0.dev20240221
[pip3] triton==2.2.0
[pip3] vit-pytorch==1.6.5
[conda] blas                      1.0                         mkl  
[conda] libjpeg-turbo             2.0.0                h9bf148f_0    pytorch-nightly
[conda] mkl                       2023.1.0         h213fc3f_46344  
[conda] mkl-service               2.4.0           py310h5eee18b_1  
[conda] mkl_fft                   1.3.8           py310h5eee18b_0  
[conda] mkl_random                1.2.4           py310hdb19cb5_0  
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] optree                    0.10.0                   pypi_0    pypi
[conda] pytorch                   2.3.0.dev20240221 py3.10_cuda12.1_cudnn8.9.2_0    pytorch-nightly
[conda] pytorch-cuda              12.1                 ha16c6d3_5    pytorch-nightly
[conda] pytorch-mutex             1.0                        cuda    pytorch-nightly
[conda] torchaudio                2.2.0.dev20240221     py310_cu121    pytorch-nightly
[conda] torchelastic              0.2.2                    pypi_0    pypi
[conda] torchvision               0.18.0.dev20240221     py310_cu121    pytorch-nightly
[conda] triton                    2.2.0                    pypi_0    pypi
[conda] vit-pytorch               1.6.5                    pypi_0    pypi
```

cc @ezyang @msaroufim @bdhirsh @anijain2305 @zou3519 @chauhang @avikchaudhuri @gmagogsfm @zhxchen17 @tugsbayasgalan @angelayi @suo @ydwu4