mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
Uses the assignment syntax to get deterministic ordering of parameters. The ordering of parameters using the constructor syntax is non-deterministic because kwargs use dict() in Python 3.5 and earlier.
11 lines
278 B
Python
11 lines
278 B
Python
from torch.autograd import Variable
|
|
|
|
|
|
class Parameter(Variable):
|
|
|
|
def __init__(self, data, requires_grad=True):
|
|
super(Parameter, self).__init__(data, requires_grad=requires_grad)
|
|
|
|
def __repr__(self):
|
|
return 'Parameter containing:' + self.data.__repr__()
|