From a48652e3793db03ba76623a3a07ca3a9c5cc1700 Mon Sep 17 00:00:00 2001 From: ydwu4 Date: Sat, 11 Mar 2023 00:41:23 +0000 Subject: [PATCH] Assert that there are no None arguments to backwards (#96300) This assert would have caught https://github.com/pytorch/pytorch/pull/96219 Signed-off-by: Edward Z. Yang Pull Request resolved: https://github.com/pytorch/pytorch/pull/96300 Approved by: https://github.com/bdhirsh --- torch/_functorch/aot_autograd.py | 1 + 1 file changed, 1 insertion(+) diff --git a/torch/_functorch/aot_autograd.py b/torch/_functorch/aot_autograd.py index 214600c39ecea..9cb60feac9d1b 100644 --- a/torch/_functorch/aot_autograd.py +++ b/torch/_functorch/aot_autograd.py @@ -2356,6 +2356,7 @@ def backward(ctx, *flat_args): def call_compiled_backward(): if CompiledFunction.compiled_bw is None: + assert all(a is not None for a in all_args) if aot_config.dynamic_shapes: all_args_list = list(all_args) CompiledFunction.compiled_bw = create_aot_dispatcher_function(