LSTM.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:deep-motion-analysis 作者: Brimborough 项目源码 文件源码
def __init__(self, options, shape, rng, drop=0, zone_hidden=0, zone_cell=0, prefix="lstm",
                 bn=False, clip_gradients=False, mask=None):

        self.nsteps = shape
        self.mask = mask if mask is None else '' #TODO: Make mask
        self.prefix = prefix
        #TODO: Replace options and update the step function
        self.options = options
        self.clip_gradients = clip_gradients
        self.params = init_params(param_init_lstm(options=options, params=[], prefix=prefix))
        #TODO: Sort shapes, can have input,hidden for W, U = hidden,hidden, b = hidden
        # Saves upon changing code lots below.
        self.bninput = BatchNormLayer(None, shape) if bn else lambda x: x
        self.bnhidden = BatchNormLayer(None, shape) if bn else lambda x: x
        self.bncell = BatchNormLayer(None, shape) if bn else lambda x: x
        # Add BN params to layer (for SGD)
        if bn:
            self.params += self.bnhidden.params + self.bninput.params + self.bncell.params
        self.dropout = drop
        self.zoneout = {'h': zone_hidden, 'c': zone_cell}
        self.theano_rng = RandomStreams(rng.randint(2 ** 30))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号