Repository: pytorch
Issue: DISABLED test_dynamo_export_retains_readable_parameter_and_buffer_names (__main__.TestFxToOnnx)
Labels: module: onnx,triaged,module: flaky-tests,skipped

Platforms: linux

This test was disabled because it is failing in CI. See [recent examples](https://hud.pytorch.org/flakytest?name=test_dynamo_export_retains_readable_parameter_and_buffer_names&suite=TestFxToOnnx&limit=100) and the most recent trunk [workflow logs](https://github.com/pytorch/pytorch/runs/31586854408).

Over the past 3 hours, it has been determined flaky in 7 workflow(s) with 7 failures and 7 successes.

**Debugging instructions (after clicking on the recent samples link):**
DO NOT ASSUME THINGS ARE OKAY IF THE CI IS GREEN. We now shield flaky tests from developers so CI will thus be green but it will be harder to parse the logs.
To find relevant log snippets:
1. Click on the workflow logs linked above
2. Click on the Test step of the job so that it is expanded. Otherwise, the grepping will not work.
3. Grep for `test_dynamo_export_retains_readable_parameter_and_buffer_names`
4. There should be several instances run (as flaky tests are rerun in CI) from which you can study the logs.



<details><summary>Sample error message</summary>

```
Traceback (most recent call last):
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/_exporter_legacy.py", line 796, in dynamo_export
    return Exporter(
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/_exporter_legacy.py", line 560, in export
    graph_module = self.options.fx_tracer.generate_fx(
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/fx/dynamo_graph_extractor.py", line 217, in generate_fx
    return self.pre_export_passes(options, model, graph_module, updated_model_args)  # type: ignore[return-value]
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/fx/dynamo_graph_extractor.py", line 226, in pre_export_passes
    return _exporter_legacy.common_pre_export_passes(
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/_exporter_legacy.py", line 837, in common_pre_export_passes
    module = passes.Functionalize(
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/diagnostics/infra/decorator.py", line 146, in wrapper
    ctx.log_and_raise_if_error(diag)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/diagnostics/infra/context.py", line 355, in log_and_raise_if_error
    raise diagnostic.source_exception
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/diagnostics/infra/decorator.py", line 130, in wrapper
    return_values = fn(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/fx/_pass.py", line 275, in run
    module = self._run(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/fx/passes/functionalization.py", line 120, in _run
    graph_module = proxy_tensor.make_fx(
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/experimental/proxy_tensor.py", line 2151, in wrapped
    return make_fx_tracer.trace(f, *args)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/experimental/proxy_tensor.py", line 2089, in trace
    return self._trace_inner(f, *args)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/experimental/proxy_tensor.py", line 2060, in _trace_inner
    t = dispatch_trace(
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_compile.py", line 32, in inner
    return disable_fn(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_dynamo/eval_frame.py", line 654, in _fn
    return fn(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/experimental/proxy_tensor.py", line 1137, in dispatch_trace
    graph = tracer.trace(root, concrete_args)  # type: ignore[arg-type]
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_dynamo/eval_frame.py", line 654, in _fn
    return fn(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/_symbolic_trace.py", line 827, in trace
    (self.create_arg(fn(*args)),),
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/experimental/proxy_tensor.py", line 1192, in wrapped
    out = f(*tensors)
  File "<string>", line 1, in <lambda>
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/fx/passes/functionalization.py", line 84, in wrapped
    out = function(*inputs_functional)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/fx/passes/_utils.py", line 28, in wrapped
    return torch.fx.Interpreter(graph_module).run(*args)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/interpreter.py", line 146, in run
    self.env[node] = self.run_node(node)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/interpreter.py", line 203, in run_node
    return getattr(self, n.op)(n.target, args, kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/interpreter.py", line 275, in call_function
    return target(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_ops.py", line 723, in __call__
    return self._op(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/experimental/proxy_tensor.py", line 1240, in __torch_function__
    return func(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_ops.py", line 723, in __call__
    return self._op(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/utils/_stats.py", line 21, in wrapper
    return fn(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/experimental/proxy_tensor.py", line 1333, in __torch_dispatch__
    return proxy_call(self, func, self.pre_dispatch, args, kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/fx/experimental/proxy_tensor.py", line 911, in proxy_call
    out = func(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_ops.py", line 723, in __call__
    return self._op(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/utils/_stats.py", line 21, in wrapper
    return fn(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_subclasses/fake_tensor.py", line 1254, in __torch_dispatch__
    return self.dispatch(func, types, args, kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_subclasses/fake_tensor.py", line 1799, in dispatch
    return self._cached_dispatch_impl(func, types, args, kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_subclasses/fake_tensor.py", line 1364, in _cached_dispatch_impl
    output = self._dispatch_impl(func, types, args, kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_subclasses/fake_tensor.py", line 2128, in _dispatch_impl
    op_impl_out = op_impl(self, func, *args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_subclasses/fake_impls.py", line 147, in dispatch_to_op_implementations_dict
    return op_implementations_dict[func](fake_mode, func, *args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_subclasses/fake_impls.py", line 741, in conv
    out = func(**kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_ops.py", line 723, in __call__
    return self._op(*args, **kwargs)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_meta_registrations.py", line 2257, in meta_conv
    shape_out = calc_conv_nd_return_shape(
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/_meta_registrations.py", line 2174, in calc_conv_nd_return_shape
    kernel_size = weight.shape[2:]
AttributeError: 'NoneType' object has no attribute 'shape'

While executing %convolution : [num_users=1] = call_function[target=torch.ops.aten.convolution.default](args = (%l_tensor_x_, %_param_constant0, None, [1, 1], [0, 0], [1, 1], False, [0, 0], 1), kwargs = {})
Original traceback:
  File "/var/lib/jenkins/workspace/test/onnx/test_fx_to_onnx.py", line 139, in forward
    tensor_x = self.conv1(tensor_x)


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/var/lib/jenkins/workspace/test/onnx/test_fx_to_onnx.py", line 149, in test_dynamo_export_retains_readable_parameter_and_buffer_names
    onnx_program = torch.onnx.dynamo_export(model, tensor_x)
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/__init__.py", line 517, in dynamo_export
    return dynamo_export(
  File "/opt/conda/envs/py_3.9/lib/python3.9/site-packages/torch/onnx/_internal/_exporter_legacy.py", line 812, in dynamo_export
    raise errors.OnnxExporterError(message) from e
torch.onnx.OnnxExporterError: Failed to export the model to ONNX. Generating SARIF report at 'report_dynamo_export.sarif'. SARIF is a standard format for the output of static analysis tools. SARIF logs can be loaded in VS Code SARIF viewer extension, or SARIF web viewer (https://microsoft.github.io/sarif-web-component/). Please report a bug on PyTorch Github: https://github.com/pytorch/pytorch/issues

To execute this test, run the following from the base repo dir:
    python test/onnx/test_fx_to_onnx.py TestFxToOnnx.test_dynamo_export_retains_readable_parameter_and_buffer_names

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
```

</details>


Test file path: `onnx/test_fx_to_onnx.py`

cc @clee2000