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)
评论列表
文章目录