Skip to content

Commit 937dedf

Browse files
committed
fix: reorder the import sequence.
1 parent a36907f commit 937dedf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lightning/pytorch/core/module.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,8 +1542,6 @@ def forward(self, x):
15421542
f"`{type(self).__name__}.to_tensorrt` requires `torch_tensorrt` to be installed. "
15431543
)
15441544

1545-
import torch_tensorrt
1546-
15471545
mode = self.training
15481546
device = self.device
15491547
if self.device.type != "cuda":
@@ -1564,6 +1562,9 @@ def forward(self, x):
15641562
" `model.example_input_array` attribute is set."
15651563
)
15661564
input_sample = self.example_input_array
1565+
1566+
import torch_tensorrt
1567+
15671568
input_sample = copy.deepcopy((input_sample,) if isinstance(input_sample, torch.Tensor) else input_sample)
15681569
input_sample = self._on_before_batch_transfer(input_sample)
15691570
input_sample = self._apply_batch_transfer_handler(input_sample)

0 commit comments

Comments
 (0)