sparse tensor operations (#735)

This commit is contained in:
Martin Raison
2017-03-03 18:37:03 +01:00
committed by Adam Paszke
parent c93c884ee2
commit f17cfe4293
52 changed files with 2555 additions and 270 deletions

View File

@ -132,7 +132,8 @@ class Optimizer(object):
"""Clears the gradients of all optimized :class:`Variable` s."""
for group in self.param_groups:
for param in group['params']:
param.grad.data.zero_()
if param.grad is not None:
param.grad.data.zero_()
def step(self, closure):
"""Performs a single optimization step (parameter update).