Skip to content

Commit b57d6cd

Browse files
committed
nit: check if array is None
Signed-off-by: gcunhase <[email protected]>
1 parent e5dcb0d commit b57d6cd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modelopt/onnx/trt_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ def load_onnx_model(
298298

299299
static_shaped_onnx_path = onnx_path.replace(".onnx", "_static.onnx")
300300
save_onnx(onnx_model, static_shaped_onnx_path, use_external_data_format)
301-
intermediate_generated_files.append(static_shaped_onnx_path) # type: ignore[union-attr]
301+
if intermediate_generated_files is not None:
302+
intermediate_generated_files.append(static_shaped_onnx_path)
302303

303304
if TRT_PYTHON_AVAILABLE and platform.system() != "Windows":
304305
# Check if there's a custom TensorRT op in the ONNX model. If so, make it ORT compatible by adding
@@ -330,7 +331,8 @@ def load_onnx_model(
330331
else onnx_path.replace(".onnx", f"_ir{MAX_IR_VERSION}.onnx")
331332
)
332333
save_onnx(onnx_model, ir_version_onnx_path, use_external_data_format)
333-
intermediate_generated_files.append(ir_version_onnx_path) # type: ignore[union-attr]
334+
if intermediate_generated_files is not None:
335+
intermediate_generated_files.append(ir_version_onnx_path)
334336

335337
# Check that the model is valid
336338
onnx.checker.check_model(onnx_model)

0 commit comments

Comments
 (0)