Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: YunLiu <[email protected]>
  • Loading branch information
KumoLiu committed Aug 14, 2024
1 parent b76d04b commit c322f57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions monai/networks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ def convert_to_trt(
warnings.warn(f"The dynamic batch range sequence should have 3 elements, but got {dynamic_batchsize} elements.")

device = device if device else 0
target_device = torch.device(f"cuda:{device}") if device else torch.device("cuda:0")
target_device = torch.device(f"cuda:{device}")
convert_precision = torch.float32 if precision == "fp32" else torch.half
inputs = [torch.rand(ensure_tuple(input_shape)).to(target_device)]

Expand Down Expand Up @@ -986,7 +986,7 @@ def scale_batch_size(input_shape: Sequence[int], scale_num: int):
ir_model,
inputs=input_placeholder,
enabled_precisions=convert_precision,
device=target_device,
device=torch_tensorrt.Device(f"cuda:{device}"),
ir="torchscript",
**kwargs,
)
Expand Down

0 comments on commit c322f57

Please sign in to comment.