mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Adding description for Optimizers (#4371)
This commit is contained in:
committed by
Adam Paszke
parent
5c33400dd3
commit
89acc10f85
@ -47,6 +47,17 @@ class Optimizer(object):
|
||||
def __setstate__(self, state):
|
||||
self.__dict__.update(state)
|
||||
|
||||
def __repr__(self):
|
||||
format_string = self.__class__.__name__ + ' ('
|
||||
for i, group in enumerate(self.param_groups):
|
||||
format_string += '\n'
|
||||
format_string += 'Parameter Group {0}\n'.format(i)
|
||||
for key in sorted(group.keys()):
|
||||
if key != 'params':
|
||||
format_string += ' {0}: {1}\n'.format(key, group[key])
|
||||
format_string += ')'
|
||||
return format_string
|
||||
|
||||
def state_dict(self):
|
||||
"""Returns the state of the optimizer as a :class:`dict`.
|
||||
|
||||
|
Reference in New Issue
Block a user