Skip to content

Commit

Permalink
Update to make pydocstyle --numpy compliant.
Browse files Browse the repository at this point in the history
  • Loading branch information
jatkinson1000 committed Nov 10, 2023
1 parent 9ead87d commit f61cdcc
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 9 deletions.
4 changes: 1 addition & 3 deletions examples/1_SimpleNet/simplenet.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Module defining a simple PyTorch 'Net' for coupling to Fortran. """
"""Module defining a simple PyTorch 'Net' for coupling to Fortran."""
import torch
from torch import nn

Expand All @@ -15,7 +15,6 @@ def __init__(
Consists of a single Linear layer with weights predefined to
multiply the input by 2.
"""

super().__init__()
self._fwd_seq = nn.Sequential(
nn.Linear(5, 5, bias=False),
Expand All @@ -38,7 +37,6 @@ def forward(self, batch: torch.Tensor) -> torch.Tensor:
batch scaled by 2.
"""

return self._fwd_seq(batch)


Expand Down
Binary file added examples/1_SimpleNet/simplenet_infer_fortran
Binary file not shown.
1 change: 0 additions & 1 deletion examples/1_SimpleNet/simplenet_infer_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def deploy(saved_model: str, device: str, batch_size: int = 1) -> torch.Tensor:
output : torch.Tensor
result of running inference on model with example Tensor input
"""

input_tensor = torch.tensor([0.0, 1.0, 2.0, 3.0, 4.0]).repeat(batch_size, 1)

if device == "cpu":
Expand Down
3 changes: 1 addition & 2 deletions examples/2_ResNet18/resnet18.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def initialize(precision: torch.dtype) -> torch.nn.Module:
model: torch.nn.Module
Pretrained ResNet-18 model
"""

# Set working precision
torch.set_default_dtype(precision)

Expand Down Expand Up @@ -96,7 +95,7 @@ def run_model(model: torch.nn.Module, precision: type) -> None:


def print_top_results(output: torch.Tensor) -> None:
"""Prints top 5 results
"""Print top 5 results.
Parameters
----------
Expand Down
2 changes: 0 additions & 2 deletions examples/n_c_and_cpp/resnet18.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def initialize():
-------
model : torch.nn.Module
"""

# Load a pre-trained PyTorch model
print("Loading pre-trained ResNet-18 model...", end="")
model = torchvision.models.resnet18(pretrained=True)
Expand All @@ -35,7 +34,6 @@ def run_model(model):
----------
model : torch.nn.Module
"""

print("Running ResNet-18 model for ones...", end="")
dummy_input = torch.ones(1, 3, 224, 224)
output = model(dummy_input)
Expand Down
1 change: 0 additions & 1 deletion examples/n_c_and_cpp/resnet_infer_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def deploy(saved_model, device, batch_size=1):
output : torch.Tensor
result of running inference on model with Tensor of ones
"""

image_filename = "data/dog.jpg"
input_image = Image.open(image_filename)
preprocess = torchvision.transforms.Compose(
Expand Down

0 comments on commit f61cdcc

Please sign in to comment.