sklearn_wrapper.py 文件源码

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

项目:chainer_sklearn 作者: corochann 项目源码 文件源码
def _forward(self, *args, calc_score=False):
        """Forward computation without backward.

        Predicts by the model's output by returning `predictor`'s output
        """
        with chainer.using_config('train', False), chainer.no_backprop_mode():
            if calc_score:
                self(*args)
                return self.y
            else:
                if self.predictor is None:
                    print("[ERROR] predictor is not set or not build yet.")
                    return
                # TODO: it passes all the args, sometimes (x, y) which is too many arguments.
                # Consider how to deal with the number of input
                if hasattr(self.predictor, '_forward'):
                    fn = self.predictor._forward
                else:
                    fn = self.predictor
                return fn(*filter_args(fn, args))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号