Skip to content

Commit

Permalink
Removed the no use SimpleNetwork.
Browse files Browse the repository at this point in the history
  • Loading branch information
yhwen committed Sep 20, 2024
1 parent 1f111f1 commit d5c210a
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions examples/hello-world/hello-pt-resnet/src/simple_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,11 @@
# limitations under the License.
from typing import Optional, Any

import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision.models import ResNet
from torchvision.models._utils import _ovewrite_named_param
from torchvision.models.resnet import BasicBlock, ResNet18_Weights


class SimpleNetwork(nn.Module):
def __init__(self):
super(SimpleNetwork, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 * 5 * 5, 120)
self.fc2 = nn.Linear(120, 84)
self.fc3 = nn.Linear(84, 10)

def forward(self, x):
x = self.pool(F.relu(self.conv1(x)))
x = self.pool(F.relu(self.conv2(x)))
x = torch.flatten(x, 1) # flatten all dimensions except batch
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = self.fc3(x)
return x

class Resnet18(ResNet):

def __init__(self, num_classes, weights: Optional[ResNet18_Weights] = None, progress: bool = True, **kwargs: Any):
Expand Down

0 comments on commit d5c210a

Please sign in to comment.