Skip to main content

ClikaRT::ops::group_norm

function

group_norm()

Tensor group_norm(
    Tensor x,
    int64_t num_groups,
    OptionalTensor weight = {},
    OptionalTensor bias = {},
    OptionalTensor running_mean = {},
    OptionalTensor running_var = {},
    std::optional<double> eps = std::nullopt,
    std::optional<Activation> activation = std::nullopt
)

Group normalization: channels split into num_groups groups, normalized per group (channels-last).

Statistics are computed per (sample, group) over the group's channels and the spatial dims; with running_mean / running_var present they are folded per channel instead (batch-norm style). Optional fused activation applies to the result.

Parameters

  • x: the input, [N, *spatial, C].
  • num_groups: number of channel groups; must divide C.
  • weight: optional per-channel scale [C].
  • bias: optional per-channel shift [C].
  • running_mean: optional precomputed per-channel mean [C].
  • running_var: optional precomputed per-channel variance [C].
  • eps: stability floor; std::nullopt selects 1e-5.
  • activation: optional fused activation; absent = none.

Returns: a new tensor, same shape and dtype as x.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when num_groups does not divide the channel count or an operand is mis-shaped.

Declared in ClikaRT/compute/ops.h, line 3615