Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add torch no grad, reduce GPU mem significantly #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions u2net_portrait_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ def main():
inputs_test = Variable(inputs_test.cuda())
else:
inputs_test = Variable(inputs_test)

d1,d2,d3,d4,d5,d6,d7= net(inputs_test)

with torch.no_grad():
d1,d2,d3,d4,d5,d6,d7= net(inputs_test)

# normalization
pred = 1.0 - d1[:,0,:,:]
Expand Down
5 changes: 3 additions & 2 deletions u2net_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ def main():
inputs_test = Variable(inputs_test.cuda())
else:
inputs_test = Variable(inputs_test)

d1,d2,d3,d4,d5,d6,d7= net(inputs_test)

with torch.no_grad():
d1,d2,d3,d4,d5,d6,d7= net(inputs_test)

# normalization
pred = d1[:,0,:,:]
Expand Down