rnn.py 文件源码

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

项目:cortex 作者: rdevon 项目源码 文件源码
def __call__(self, x, m=None, h0s=None, condition_on=None):
        '''Call function.

        For learning RNNs.

        Args:
            x (T.tensor): input sequence. window x batch x dim
            m (T.tensor): mask. window x batch. For masking in recurrent steps.
            h0s (Optional[list]): initial h0s.
            condition_on (Optional[T.tensor]): conditional for recurrent step.

        Returns:
            OrderedDict: dictionary of results: hiddens, probabilities, and
                preacts.
            theano.OrderedUpdates.

        '''
        if h0s is None:
            h0s = [T.alloc(0., x.shape[1], dim_h).astype(floatX) for dim_h in self.dim_hs]

        if m is None:
            m = T.ones((x.shape[0], x.shape[1])).astype(floatX)

        params = self.get_sample_params()

        return self.step_call(x, m, h0s, *params)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号