conv.py 文件源码

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

项目:pytorch-coriander 作者: hughperkins 项目源码 文件源码
def _grad_params(self, input, weight, bias, grad_output):
        if self.use_cudnn:
            grad_weight = grad_bias = None
            if self.needs_input_grad[1]:
                grad_weight = weight.new().resize_as_(weight)
                torch._C._cudnn_convolution_backward_filter(
                    grad_output, input, grad_weight, self._cudnn_info,
                    cudnn.benchmark)

            if bias is not None and self.needs_input_grad[2]:
                grad_bias = bias.new().resize_as_(bias)
                torch._C._cudnn_convolution_backward_bias(
                    grad_output, grad_bias, self._cudnn_info)

            return grad_weight, grad_bias

        return self._thnn('grad_params', input, weight, bias, grad_output)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号