in src/inplace_abn.cpp [96:137]
std::tuple<at::Tensor, at::Tensor, at::Tensor, at::Tensor> backward_reduce(
const at::Tensor& y_act,
const at::Tensor& dy_act,
const c10::optional<at::Tensor>& weight,
const c10::optional<at::Tensor>& bias,
float eps,
Activation activation,
float activation_param) {
// Check dimensions and types
IABN_CHECK(
y_act.ndimension() >= 2, "y_act should have at least 2 dimensions");
IABN_CHECK(
have_same_dims(y_act, dy_act),
"y_act and dy_act should have the same size");
CHECK_SAME_TYPE(y_act, dy_act);
if (weight.has_value())
IABN_CHECK(
is_compatible_weight(y_act, weight.value()),
"weight is not compatible with y_act (wrong size or scalar type)");
if (bias.has_value())
IABN_CHECK(
is_compatible_weight(y_act, bias.value()),
"bias is not compatible with y_act (wrong size or scalar type)");
if (weight.has_value() && bias.has_value())
CHECK_SAME_TYPE(weight.value(), bias.value());
IABN_CHECK(
(weight.has_value() && bias.has_value()) ||
(!weight.has_value() && !bias.has_value()),
"weight and bias must be equally present or not present");
CUDA_DISPATCH(
y_act,
backward_reduce,
y_act,
dy_act,
weight,
bias,
eps,
activation,
activation_param)
}