@@ -213,8 +213,9 @@ def _make_exporter_export(
213213 backed_size_oblivious = backed_size_oblivious ,
214214 )
215215 else :
216- with contextlib .redirect_stdout (io .StringIO ()), contextlib .redirect_stderr (
217- io .StringIO ()
216+ with (
217+ contextlib .redirect_stdout (io .StringIO ()),
218+ contextlib .redirect_stderr (io .StringIO ()),
218219 ):
219220 exported = _wrap_torch_export (
220221 model ,
@@ -260,8 +261,9 @@ def _make_exporter_export(
260261 else exported .run_decompositions ({})
261262 )
262263 else :
263- with contextlib .redirect_stdout (io .StringIO ()), contextlib .redirect_stderr (
264- io .StringIO ()
264+ with (
265+ contextlib .redirect_stdout (io .StringIO ()),
266+ contextlib .redirect_stderr (io .StringIO ()),
265267 ):
266268 exported = _wrap_torch_export (
267269 model ,
@@ -295,8 +297,9 @@ def _make_exporter_export(
295297 graph = CustomTracer ().trace (model )
296298 mod = torch .fx .GraphModule (model , graph )
297299 else :
298- with contextlib .redirect_stdout (io .StringIO ()), contextlib .redirect_stderr (
299- io .StringIO ()
300+ with (
301+ contextlib .redirect_stdout (io .StringIO ()),
302+ contextlib .redirect_stderr (io .StringIO ()),
300303 ):
301304 graph = CustomTracer ().trace (model )
302305 mod = torch .fx .GraphModule (model , graph )
@@ -341,8 +344,9 @@ def _make_exporter_onnx(
341344 return_builder = True ,
342345 )
343346 else :
344- with contextlib .redirect_stdout (io .StringIO ()), contextlib .redirect_stderr (
345- io .StringIO ()
347+ with (
348+ contextlib .redirect_stdout (io .StringIO ()),
349+ contextlib .redirect_stderr (io .StringIO ()),
346350 ):
347351 onx , builder = to_onnx (
348352 model ,
@@ -375,8 +379,9 @@ def _make_exporter_onnx(
375379 report = True ,
376380 ).model_proto
377381 else :
378- with contextlib .redirect_stdout (io .StringIO ()), contextlib .redirect_stderr (
379- io .StringIO ()
382+ with (
383+ contextlib .redirect_stdout (io .StringIO ()),
384+ contextlib .redirect_stderr (io .StringIO ()),
380385 ):
381386 onx = torch .onnx .export (
382387 model ,
@@ -410,8 +415,9 @@ def _make_exporter_onnx(
410415 ep .optimize ()
411416 onx = ep .model_proto
412417 else :
413- with contextlib .redirect_stdout (io .StringIO ()), contextlib .redirect_stderr (
414- io .StringIO ()
418+ with (
419+ contextlib .redirect_stdout (io .StringIO ()),
420+ contextlib .redirect_stderr (io .StringIO ()),
415421 ):
416422 ep = torch .onnx .export (
417423 model ,
0 commit comments