Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def forward(self, x, y=None, criterion=None, gpu_nums=1):
- x = self.task(x)
- if not y == None:
- loss = criterion(x, y)
- if gpu_nums > 1:
- loss /= gpu_nums
- loss.backward()
- return x, loss
- return x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement