Skip to content

Commit

Permalink
Test fixes; drop unnecessary imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jwallwork23 committed Feb 19, 2025
1 parent 69a4f45 commit 7d1f098
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 11 deletions.
1 change: 0 additions & 1 deletion examples/1_SimpleNet/pt2ts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Load a PyTorch model and convert it to TorchScript."""

import os
import sys
from typing import Optional

# FPTLIB-TODO
Expand Down
1 change: 0 additions & 1 deletion examples/1_SimpleNet/simplenet_infer_python.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Load saved SimpleNet to TorchScript and run inference example."""

import os
import sys

import torch

Expand Down
1 change: 0 additions & 1 deletion examples/2_ResNet18/pt2ts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Load a PyTorch model and convert it to TorchScript."""

import os
import sys
from typing import Optional

# FPTLIB-TODO
Expand Down
1 change: 0 additions & 1 deletion examples/2_ResNet18/resnet_infer_python.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Load ResNet-18 saved to TorchScript and run inference with an example image."""

import os
import sys
from math import isclose

import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion examples/3_MultiGPU/multigpu_infer_fortran.f90
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ program inference
200 format("output on device ", i1,": [", 4(f5.1,","), f5.1,"]")

! Check output tensor matches expected value
expected = [(device_index + 2*i, i = 0, 4)]
expected = [(2 * (device_index + i), i = 0, 4)]
test_pass = assert_allclose(out_data, expected, test_name="MultiGPU")

! Cleanup
Expand Down
2 changes: 2 additions & 0 deletions examples/3_MultiGPU/multigpu_infer_python.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Load saved SimpleNet to TorchScript and run inference example."""

import os

import torch


Expand Down
1 change: 0 additions & 1 deletion examples/3_MultiGPU/pt2ts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Load a PyTorch model and convert it to TorchScript."""

import os
import sys
from typing import Optional

# FPTLIB-TODO
Expand Down
2 changes: 1 addition & 1 deletion examples/3_MultiGPU/simplenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def forward(self, batch: torch.Tensor) -> torch.Tensor:
f" {input_tensor_gpu.get_device()}"
)
with torch.no_grad():
output_tensor = model(input_tensor_gpu)
output_tensor = model(input_tensor_gpu).to("cpu")

print(output_tensor)
if not torch.allclose(output_tensor, 2 * input_tensor):
Expand Down
1 change: 0 additions & 1 deletion examples/4_MultiIO/multiionet_infer_python.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Load saved MultIONet to TorchScript and run inference example."""

import os
import sys

import torch

Expand Down
1 change: 0 additions & 1 deletion examples/4_MultiIO/pt2ts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Load a PyTorch model and convert it to TorchScript."""

import os
import sys
from typing import Optional

# FPTLIB-TODO
Expand Down
1 change: 0 additions & 1 deletion examples/5_Looping/pt2ts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Load a PyTorch model and convert it to TorchScript."""

import os
import sys
from typing import Optional

# FPTLIB-TODO
Expand Down
1 change: 0 additions & 1 deletion utils/pt2ts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Load a PyTorch model and convert it to TorchScript."""

import os
import sys
from typing import Optional

# FPTLIB-TODO
Expand Down

0 comments on commit 7d1f098

Please sign in to comment.