test_cpu_gpu_parity_nn_AdaptiveAvgPool2d_cuda_float32: networkx.exception.NetworkXError: node sink not in graph
Labels: triaged

Repro:
Comment out https://github.com/pytorch/pytorch/blob/cda0d5a57b9126c6d244fdd5b02198f05c742615/test/test_modules.py#L494, and then run
```
PYTORCH_TEST_WITH_INDUCTOR=1 python test/test_modules.py -k test_cpu_gpu_parity_nn_AdaptiveAvgPool2d_cuda_float32
```

Error:
```
Traceback (most recent call last):
  File "/fsx/users/binbao/pytorch/torch/testing/_internal/common_utils.py", line 2001, in wrapper
    method(*args, **kwargs)
  File "/fsx/users/binbao/pytorch/torch/testing/_internal/common_utils.py", line 2001, in wrapper
    method(*args, **kwargs)
  File "/fsx/users/binbao/pytorch/torch/testing/_internal/common_device_type.py", line 381, in instantiated_test
    result = test(self, **param_kwargs)
  File "/fsx/users/binbao/pytorch/torch/testing/_internal/common_modules.py", line 112, in test_wrapper
    return test(*args, **kwargs)
  File "/fsx/users/binbao/pytorch/torch/testing/_internal/common_device_type.py", line 991, in only_fn
    return fn(slf, *args, **kwargs)
  File "/fsx/users/binbao/pytorch/test/test_modules.py", line 508, in test_cpu_gpu_parity
    module_inputs_cpu = module_info.module_inputs_func(module_info, device="cpu", dtype=dtype,
  File "/fsx/users/binbao/pytorch/test/test_modules.py", line 530, in <graph break in test_cpu_gpu_parity>
    self._retain_grad((cpu_forward_args, cpu_forward_kwargs, gpu_forward_args, gpu_forward_kwargs))
  File "/fsx/users/binbao/pytorch/test/test_modules.py", line 314, in _retain_grad
    self._traverse_obj(obj, inner_retain_grad)
  File "/fsx/users/binbao/pytorch/test/test_modules.py", line 300, in _traverse_obj
    return type(obj)(self._traverse_obj(o, func) for o in obj)
  File "/fsx/users/binbao/pytorch/test/test_modules.py", line 300, in <graph break in _traverse_obj>
    return type(obj)(self._traverse_obj(o, func) for o in obj)
  File "/fsx/users/binbao/pytorch/test/test_modules.py", line 300, in <genexpr>
    return type(obj)(self._traverse_obj(o, func) for o in obj)
  File "/fsx/users/binbao/pytorch/test/test_modules.py", line 300, in _traverse_obj
    return type(obj)(self._traverse_obj(o, func) for o in obj)
  File "/fsx/users/binbao/pytorch/test/test_modules.py", line 300, in <graph break in _traverse_obj>
    return type(obj)(self._traverse_obj(o, func) for o in obj)
  File "/fsx/users/binbao/pytorch/test/test_modules.py", line 300, in <genexpr>
    return type(obj)(self._traverse_obj(o, func) for o in obj)
  File "/fsx/users/binbao/pytorch/test/test_modules.py", line 301, in _traverse_obj
    elif isgenerator(obj):
  File "/fsx/users/binbao/pytorch/test/test_modules.py", line 301, in <graph break in _traverse_obj>
    elif isgenerator(obj):
  File "/fsx/users/binbao/pytorch/torch/_dynamo/eval_frame.py", line 157, in _fn
    return fn(*args, **kwargs)
  File "/fsx/users/binbao/pytorch/functorch/_src/aot_autograd.py", line 870, in forward
    return compiled_f(
  File "/fsx/users/binbao/pytorch/functorch/_src/aot_autograd.py", line 856, in new_func
    compiled_fn = create_aot_dispatcher_function(
  File "/fsx/users/binbao/torchdynamo-tip/torchdynamo/utils.py", line 86, in time_wrapper
    r = func(*args, **kwargs)
  File "/fsx/users/binbao/pytorch/functorch/_src/aot_autograd.py", line 576, in create_aot_dispatcher_function
    aot_dispatch_autograd(flat_fn, fake_flat_tensor_args, aot_config)
  File "/fsx/users/binbao/pytorch/functorch/_src/aot_autograd.py", line 423, in aot_dispatch_autograd
    fw_module, bw_module = aot_config.partition_fn(fx_g, joint_inputs)
  File "/fsx/users/binbao/pytorch/functorch/_src/partitioners.py", line 427, in min_cut_rematerialization_partition
    cut_value, partition = nx.minimum_cut(nx_graph, "source", "sink")
  File "/fsx/users/binbao/conda/envs/release/lib/python3.9/site-packages/networkx/algorithms/flow/maxflow.py", line 458, in minimum_cut
    R = flow_func(flowG, _s, _t, capacity=capacity, value_only=True, **kwargs)
  File "/fsx/users/binbao/conda/envs/release/lib/python3.9/site-packages/networkx/algorithms/flow/preflowpush.py", line 421, in preflow_push
    R = preflow_push_impl(G, s, t, capacity, residual, global_relabel_freq, value_only)
  File "/fsx/users/binbao/conda/envs/release/lib/python3.9/site-packages/networkx/algorithms/flow/preflowpush.py", line 27, in preflow_push_impl
    raise nx.NetworkXError(f"node {str(t)} not in graph")
networkx.exception.NetworkXError: node sink not in graph
```