From 5be3269c6f1ad287c1845e402e10d856143cebf0 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 2 Jan 2024 07:14:34 -0800 Subject: [PATCH] Initialize variable for all codepaths in dynamo benchmarks (#116260) Summary: Sometimes, the first statement that sets this variable in the try block fails due to out of memory issues and the finally block tries to delete this variable, but it was not written to in the first place. X-link: https://github.com/pytorch/pytorch/pull/116260 Approved by: https://github.com/lezcano Reviewed By: izaitsevfb, jeanschmidt Differential Revision: D52424766 fbshipit-source-id: 8a9b1b7c8d99148258759bef8c8f5224724bd14a --- userbenchmark/dynamo/dynamobench/common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/userbenchmark/dynamo/dynamobench/common.py b/userbenchmark/dynamo/dynamobench/common.py index f727390987..921572cbbd 100644 --- a/userbenchmark/dynamo/dynamobench/common.py +++ b/userbenchmark/dynamo/dynamobench/common.py @@ -2304,6 +2304,7 @@ def record_status(accuracy_status, dynamo_start_stats): # Collect the fp64 reference outputs to be used later for accuracy checking. fp64_outputs = None model_fp64 = None + inputs_fp64 = None try: model_fp64, inputs_fp64 = cast_to_fp64( self.deepcopy_and_maybe_ddp(model),