# Path: beacon8/optimizers/Optimizer.py
# class Optimizer:
# 
#     def __init__(self, **hyperparams):
#         self.states = {}
#         self.hyperparams = hyperparams
# 
#     def update_parameters(self, model):
# 
#         if model not in self.states:
#             params, grads = model.parameters()
#             # TODO: Not only scalar
#             hyperparams = {name: _T.scalar(name) for name in self.hyperparams}
#             updates = self.get_updates(params, grads, **hyperparams)
#             self.states[model] = _th.function(
#                 inputs=list(hyperparams.values()),
#                 updates=updates
#             )
# 
#         self.states[model](**self.hyperparams)
# 
#     def get_updates(self, params, grads):
#         raise NotImplementedError
# 
# Path: beacon8/utils.py
# def create_param_state_as(other, initial_value=0):
#     return _th.shared(other.get_value()*0 + initial_value,
#         broadcastable=other.broadcastable,
#         name='state_for_' + str(other.name)
#     )


from .Optimizer import Optimizer
from ..utils import create_param_state_as


class Momentum(Optimizer):

    def __init__(self, lr, momentum):
        Optimizer.__init__(self, lr=lr, momentum=momentum)

    def get_updates(self, params, grads, lr, momentum):
        updates = []


# Path: beacon8/optimizers/Optimizer.py
# class Optimizer:
# 
#     def __init__(self, **hyperparams):
#         self.states = {}
#         self.hyperparams = hyperparams
# 
#     def update_parameters(self, model):
# 
#         if model not in self.states:
#             params, grads = model.parameters()
#             # TODO: Not only scalar
#             hyperparams = {name: _T.scalar(name) for name in self.hyperparams}
#             updates = self.get_updates(params, grads, **hyperparams)
#             self.states[model] = _th.function(
#                 inputs=list(hyperparams.values()),
#                 updates=updates
#             )
# 
#         self.states[model](**self.hyperparams)
# 
#     def get_updates(self, params, grads):
#         raise NotImplementedError
# 
# Path: beacon8/utils.py
# def create_param_state_as(other, initial_value=0):
#     return _th.shared(other.get_value()*0 + initial_value,
#         broadcastable=other.broadcastable,
#         name='state_for_' + str(other.name)
#     )


# Path: beacon8/optimizers/Momentum.py
from .Optimizer import Optimizer
from ..utils import create_param_state_as



class Momentum(Optimizer):

    def __init__(self, lr, momentum):
        Optimizer.__init__(self, lr=lr, momentum=momentum)

    def get_updates(self, params, grads, lr, momentum):
        updates = []


        for param, grad in zip(params, grads):