Skip to content
tmpl

conv_weight_grad

→TensorImplPtr
int conv_weight_grad()

The weight gradient of a convolution, built from differentiable ops.

Used by the graph-mode backward of both ConvNd and ConvTransposeNd — for the latter with input and grad trading roles, since a transposed convolution's weight gradient is its adjoint convolution's.

Parameters

inputTensorImplPtr
The convolution's input, (B, C_in, S...).
gradTensorImplPtr
The gradient of its output, (B, C_out, O...).
stride, pad, dilationconst int (&)[N]
The convolution's own settings.
groupsint
Channel groups; C_in and C_out are both divisible by it.
weight_shapeconst Shape&
(C_out, C_in / groups, K...) — the result's shape.

Returns

TensorImplPtr

dW with weight_shape, recorded on the graph.