# Path: deeppy/base.py
# class PickleMixin(object):
#     _pickle_ignore = ['_tmp_']
# 
#     def _pickle_discard(self, attr_name):
#         for s in self._pickle_ignore:
#             if attr_name.startswith(s):
#                 return True
#         return False
# 
#     def __getstate__(self):
#         return dict((k, None) if self._pickle_discard(k) else (k, v)
#                     for k, v in self.__dict__.items())
# 
# Path: deeppy/filler.py
# class Filler(object):
#     def __init__(self):
#         raise NotImplementedError()
# 
#     @classmethod
#     def from_any(cls, arg):
#         if isinstance(arg, Filler):
#             return arg
#         elif isinstance(arg, (int, float)):
#             return ConstantFiller(arg)
#         elif isinstance(arg, (np.ndarray, ca.ndarray)):
#             return CopyFiller(arg)
#         elif isinstance(arg, tuple):
#             if len(arg) == 2:
#                 if arg[0] == 'normal':
#                     return NormalFiller(**arg[1])
#                 elif arg[0] == 'uniform':
#                     return UniformFiller(**arg[1])
#         raise ValueError('Invalid fillter arguments')
# 
#     def array(self, shape):
#         raise NotImplementedError()


import numpy as np
import cudarray as ca
import logging
from .base import PickleMixin
from .filler import Filler

log = logging.getLogger(__name__)


class Parameter(PickleMixin):
    def __init__(self, fill, name='', learn_rate=1.0, weight_decay=0.0,
                 monitor=False):
        self.filler = Filler.from_any(fill)
        self.name = name
        self.learn_rate = learn_rate
        self._monitor = monitor
        self.weight_decay = weight_decay
        self._array = None
        self._tmp_grad_array = None
        self._tmp_step = None
        self.shares = []

    @classmethod
    def from_any(cls, arg):
        if isinstance(arg, Parameter):
            return arg

# Path: deeppy/base.py
# class PickleMixin(object):
#     _pickle_ignore = ['_tmp_']
# 
#     def _pickle_discard(self, attr_name):
#         for s in self._pickle_ignore:
#             if attr_name.startswith(s):
#                 return True
#         return False
# 
#     def __getstate__(self):
#         return dict((k, None) if self._pickle_discard(k) else (k, v)
#                     for k, v in self.__dict__.items())
# 
# Path: deeppy/filler.py
# class Filler(object):
#     def __init__(self):
#         raise NotImplementedError()
# 
#     @classmethod
#     def from_any(cls, arg):
#         if isinstance(arg, Filler):
#             return arg
#         elif isinstance(arg, (int, float)):
#             return ConstantFiller(arg)
#         elif isinstance(arg, (np.ndarray, ca.ndarray)):
#             return CopyFiller(arg)
#         elif isinstance(arg, tuple):
#             if len(arg) == 2:
#                 if arg[0] == 'normal':
#                     return NormalFiller(**arg[1])
#                 elif arg[0] == 'uniform':
#                     return UniformFiller(**arg[1])
#         raise ValueError('Invalid fillter arguments')
# 
#     def array(self, shape):
#         raise NotImplementedError()


# Path: deeppy/parameter.py
import numpy as np
import cudarray as ca
import logging
from .base import PickleMixin
from .filler import Filler


log = logging.getLogger(__name__)


class Parameter(PickleMixin):
    def __init__(self, fill, name='', learn_rate=1.0, weight_decay=0.0,
                 monitor=False):
        self.filler = Filler.from_any(fill)
        self.name = name
        self.learn_rate = learn_rate
        self._monitor = monitor
        self.weight_decay = weight_decay
        self._array = None
        self._tmp_grad_array = None
        self._tmp_step = None
        self.shares = []

    @classmethod
    def from_any(cls, arg):
        if isinstance(arg, Parameter):
            return arg

        elif isinstance(arg, (int, float, np.ndarray, ca.ndarray, Filler)):