pdnnet.py 文件源码

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

项目:pdnn 作者: petered 项目源码 文件源码
def encode(self, x, shape=None):
        if shape is None:
            xp = create_shared_variable(np.zeros((0, )*x.ndim), name='xp')
            delta = ifelse(xp.size>0, x-xp, x)
        else:
            xp = create_shared_variable(np.zeros(shape), name='xp{}'.format(shape))
            delta = x - xp
        add_update(xp, x)
        y = self.kp*x + self.kd*delta
        if self.quantization is None:
            return y
        elif self.quantization=='herd':
            return herd(y, shape=shape)
        else:
            raise Exception('No quantizer: {}'.format(self.quantization))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号