Skip to content

Commit

Permalink
self -> ctx in Extending note
Browse files Browse the repository at this point in the history
  • Loading branch information
soumith committed Aug 25, 2017
1 parent 14d8c03 commit b079469
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/source/notes/extending.rst
Expand Up @@ -67,11 +67,11 @@ additional comments::
# improve efficiency. If you want to make your code simpler, you can
# skip them. Returning gradients for inputs that don't require it is
# not an error.
if self.needs_input_grad[0]:
if ctx.needs_input_grad[0]:
grad_input = grad_output.mm(weight)
if self.needs_input_grad[1]:
if ctx.needs_input_grad[1]:
grad_weight = grad_output.t().mm(input)
if bias is not None and self.needs_input_grad[2]:
if bias is not None and ctx.needs_input_grad[2]:
grad_bias = grad_output.sum(0).squeeze(0)

return grad_input, grad_weight, grad_bias
Expand Down

0 comments on commit b079469

Please sign in to comment.