Skip to content
fn

check_grad_kind

void check_grad_kind(const ErrorBuilder & err, const int & what, Dtype dtype, Device device, const int & shape, const TensorImpl & g)

Refuse g unless it has the dtype, device and shape of the gradient slot it replaces — checked in that order, as the reference checks them. what names g in the message.

Raises

DtypeMismatch, DeviceMismatch, ShapeMismatch
g is of another kind.