SahithiR commited on
Commit
aa27bf1
·
1 Parent(s): d5bc3b7

Update CUSTOMRESNET.py

Browse files
Files changed (1) hide show
  1. CUSTOMRESNET.py +9 -13
CUSTOMRESNET.py CHANGED
@@ -2,11 +2,9 @@ import torch.nn.functional as F
2
  import torch
3
  import torch.nn as nn
4
 
5
- class Net(nn.Module):
6
  def __init__(self):
7
- super(Net, self).__init__()
8
- #drop=0.01
9
- # Preparation Layer
10
  self.conv1 = nn.Sequential (
11
  nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1,bias=False),
12
  nn.BatchNorm2d(64),
@@ -57,8 +55,8 @@ class Net(nn.Module):
57
  # Fully connected
58
  self.fc = nn.Linear(512, 10, bias=True)
59
 
60
-
61
  def forward(self, x):
 
62
  x = self.conv1(x)
63
 
64
  x = self.conv11(x)
@@ -77,18 +75,16 @@ class Net(nn.Module):
77
  #x = x.randn(512, 1)
78
 
79
  # squeeze the tensor to size 512x
80
- x = x.squeeze(dim=[2, 3])
 
 
 
 
81
 
82
  #x = x.view(512, 10)
83
 
84
  x = self.fc(x)
85
 
86
  x = x.view(-1, 10)
 
87
  return x
88
- #y = F.log_softmax(x, dim=-1)
89
- #return y
90
-
91
- def model_summary(model,input_size):
92
- model = Net().to(device)
93
- summary(model, input_size=(3, 32, 32))
94
- return model,input_size
 
2
  import torch
3
  import torch.nn as nn
4
 
5
+ class MyModel(nn.Module):
6
  def __init__(self):
7
+ super().__init__()
 
 
8
  self.conv1 = nn.Sequential (
9
  nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1,bias=False),
10
  nn.BatchNorm2d(64),
 
55
  # Fully connected
56
  self.fc = nn.Linear(512, 10, bias=True)
57
 
 
58
  def forward(self, x):
59
+ #x = x.unsqueeze(0)
60
  x = self.conv1(x)
61
 
62
  x = self.conv11(x)
 
75
  #x = x.randn(512, 1)
76
 
77
  # squeeze the tensor to size 512x
78
+ #x = x.squeeze(dim=[2, 3])
79
+ x = x.squeeze(dim=2)
80
+ x = x.squeeze(dim=2)
81
+ #x = x.squeeze(dim=2).squeeze(dim=3)
82
+ #x = x.squeeze(dim=2)
83
 
84
  #x = x.view(512, 10)
85
 
86
  x = self.fc(x)
87
 
88
  x = x.view(-1, 10)
89
+ x = F.log_softmax(x, dim=-1)
90
  return x