Skip to content

Commit

Permalink
remove function def for torchscript conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ofernandesumojo authored Aug 28, 2023
1 parent 3aff740 commit 08fd725
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions clip/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,11 @@ def _make_layer(self, planes, blocks, stride=1):
return nn.Sequential(*layers)

def forward(self, x):
def stem(x):
x = self.relu1(self.bn1(self.conv1(x)))
x = self.relu2(self.bn2(self.conv2(x)))
x = self.relu3(self.bn3(self.conv3(x)))
x = self.avgpool(x)
return x

x = x.type(self.conv1.weight.dtype)
x = stem(x)
x = self.relu1(self.bn1(self.conv1(x)))
x = self.relu2(self.bn2(self.conv2(x)))
x = self.relu3(self.bn3(self.conv3(x)))
x = self.avgpool(x)
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
Expand Down

0 comments on commit 08fd725

Please sign in to comment.