Skip to content

Commit d2ba0a0

Browse files
committed
chore: Initialize shape key as non-empty string to validate no input tensor
1 parent b679811 commit d2ba0a0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

core/runtime/TRTEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ struct TRTEngine : torch::CustomClassHolder {
102102
at::cuda::CUDAStream caller_stream = c10::cuda::getDefaultCUDAStream();
103103
std::vector<at::Tensor> input_buffers = {};
104104
std::vector<at::Tensor> output_buffers = {};
105-
std::string shape_key;
105+
std::string shape_key = "None";
106106
bool cudagraphs_enabled = false;
107107
bool use_pre_allocated_outputs = true;
108108
std::vector<at::Tensor> pre_allocated_outputs;

py/torch_tensorrt/dynamo/runtime/_PythonTorchTensorRTModule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def create_output_tensors(self) -> List[torch.Tensor]:
249249
outputs.append(output)
250250
return outputs
251251

252-
def set_output_opt(self, enable: bool) -> None:
252+
def set_pre_allocated_outputs(self, enable: bool) -> None:
253253
self.use_pre_allocated_outputs = enable
254254

255255
def forward(self, *inputs: torch.Tensor) -> torch.Tensor | Tuple[torch.Tensor, ...]:

py/torch_tensorrt/dynamo/runtime/_TorchTensorRTModule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def setup_engine(self) -> None:
208208
if self.engine is not None:
209209
return
210210
self.engine = torch.classes.tensorrt.Engine(self._pack_engine_info())
211-
self.set_output_opt(True)
211+
self.set_pre_allocated_outputs(False)
212212

213213
def encode_metadata(self, metadata: Any) -> str:
214214
metadata = copy.deepcopy(metadata)
@@ -273,7 +273,7 @@ def set_extra_state(self, state: SerializedTorchTensorRTModuleFmt) -> None:
273273
self.input_binding_names = state[2]
274274
self.output_binding_names = state[3]
275275

276-
def set_output_opt(self, enable: bool) -> None:
276+
def set_pre_allocated_outputs(self, enable: bool) -> None:
277277
self.engine.use_pre_allocated_outputs = enable
278278

279279
def forward(self, *inputs: Any) -> torch.Tensor | Tuple[torch.Tensor, ...]:

0 commit comments

Comments
 (0)