pytorch/torch/nn/parameter.py
Sam Gross ffcc38cf05 Deterministic ordering of parameters and buffers. (#317)
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.
2016-12-16 14:45:56 -05:00

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__()