nn.py 文件源码

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

项目:GELUs 作者: hendrycks 项目源码 文件源码
def apply(self, x):
        s = x.shape
        if isinstance(x, np.ndarray):
            return np.dot(x.reshape((s[0],np.prod(s[1:]))) - self.mean.get_value(), self.ZCA_mat.get_value()).reshape(s)
        elif isinstance(x, T.TensorVariable):
            return T.dot(x.flatten(2) - self.mean.dimshuffle('x',0), self.ZCA_mat).reshape(s)
        else:
            raise NotImplementedError("Whitening only implemented for numpy arrays or Theano TensorVariables")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号