Skip to content

Commit 2dc5bfa

Browse files
committed
Fixed a bug of modifing settings inplace
1 parent 880afde commit 2dc5bfa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import base64
4+
import copy
45
import logging
56
import pickle
67
from typing import Any, List, Optional, Tuple
@@ -94,7 +95,7 @@ def __init__(
9495
)
9596
self.name = name
9697
self.hardware_compatible = hardware_compatible
97-
self.settings = settings
98+
self.settings = copy.deepcopy(settings)
9899
if serialized_engine is not None:
99100
self.engine = torch.classes.tensorrt.Engine(
100101
[
@@ -112,6 +113,7 @@ def __init__(
112113
self.engine = None
113114

114115
def encode_metadata(self, settings: Any) -> str:
116+
settings = copy.deepcopy(settings)
115117
settings.torch_executed_ops = {
116118
f"torch.ops.{op.__str__()}" for op in settings.torch_executed_ops
117119
}

0 commit comments

Comments
 (0)