class SGD(object):
    def __init__(self, parameters, lr):
        self.parameters = []
        for p in parameters:
            if p.requires_grade:
                self.parameters.append(p)
        # self.parameters = [p for p in parameters if p.requires_grad]
        self.lr = lr

    def update(self):
        for p in self.parameters:
            p.data -= self.lr * p.grad
7a6a8bca294121a7a60587352fa0e77c8c643b9e
<mask token>

class SGD(object):
    <mask token>
    <mask token>

class SGD(object):

    def __init__(self, parameters, lr):
        self.parameters = []
        for p in parameters:
            if p.requires_grade:
                self.parameters.append(p)
        self.lr = lr
    <mask token>

class SGD(object):

    def __init__(self, parameters, lr):
        self.parameters = []
        for p in parameters:
            if p.requires_grade:
                self.parameters.append(p)
        self.lr = lr

    def update(self):
        for p in self.parameters:
            p.data -= self.lr * p.grad

class SGD(object):
    def __init__(self, parameters, lr):
        self.parameters = []
        for p in parameters:
            if p.requires_grade:
                self.parameters.append(p)
        # self.parameters = [p for p in parameters if p.requires_grad]
        self.lr = lr

    def update(self):
        for p in self.parameters:
            p.data -= self.lr * p.grad