Skip to content

Commit

Permalink
Update usages of nn.Softmax and torch.mul_ to avoid deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
amdegroot committed Feb 15, 2018
1 parent afebb30 commit d15c97f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 31 deletions.
40 changes: 12 additions & 28 deletions demo/demo.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions ssd.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, phase, base, extras, head, num_classes):
self.conf = nn.ModuleList(head[1])

if phase == 'test':
self.softmax = nn.Softmax()
self.softmax = nn.Softmax(dim=-1)
self.detect = Detect(num_classes, 0, 200, 0.01, 0.45)

def forward(self, x):
Expand Down Expand Up @@ -97,8 +97,8 @@ def forward(self, x):
if self.phase == "test":
output = self.detect(
loc.view(loc.size(0), -1, 4), # loc preds
self.softmax(conf.view(-1, self.num_classes)) \
.view(conf.size(0), -1, self.num_classes), # conf preds
self.softmax(conf.view(conf.size(0), -1,
self.num_classes)), # conf preds
self.priors.type(type(x.data)) # default boxes
)
else:
Expand Down

0 comments on commit d15c97f

Please sign in to comment.