group_norm#
- ivy.group_norm(x, num_groups=1, /, *, offset=None, scale=None, eps=1e-05, data_format='NSC', out=None)[source]#
Apply group normalization to the input array and returns the normalized input.
- Parameters:
x (
Union
[NativeArray
,Array
]) –Input array of default shape (N, *S, C), where N is the batch dimension, *S corresponds to any number of spatial dimensions and
C corresponds to the channel dimension.
num_groups (
int
, default:1
) – number of groups to separate the channels intooffset (
Optional
[Union
[Array
,NativeArray
]], default:None
) – An offset array of size C. If present, will be added to the normalized input.scale (
Optional
[Union
[Array
,NativeArray
]], default:None
) – A scale array of size C. If present, the scale is applied to the normalized input.eps (
Optional
[float
], default:1e-05
) – A small float number to avoid dividing by 0.data_format (
Optional
[str
], default:'NSC'
) – The ordering of the dimensions in the input, one of “NSC” or “NCS”, where N is the batch dimension, S represents any number of spatial dimensions and C is the channel dimension. Default is “NSC”.out (
Optional
[Array
], default:None
) – optional output arrays, for writing the result to.
- Return type:
- Returns:
ret – The normalized array.
- Array.group_norm(self, num_groups=1, /, *, offset=None, scale=None, eps=1e-05, data_format='NSC', out=None)[source]#
ivy.Array instance method variant of ivy.group_norm. This method simply wraps the function, and so the docstring for ivy.group_norm also applies to this method with minimal changes.
- Parameters:
x – Input array of default shape (N, *S, C), where N is the batch dimension, *S corresponds to any number of spatial dimensions and C corresponds to the channel dimension.
num_groups (
int
, default:1
) – number of groups to separate the channels intooffset (
Optional
[Union
[Array
,NativeArray
]], default:None
) – An offset array of size C. If present, will be added to the normalized input.scale (
Optional
[Union
[Array
,NativeArray
]], default:None
) – A scale array of size C. If present, the scale is applied to the normalized input.eps (
Optional
[float
], default:1e-05
) – A small float number to avoid dividing by 0.data_format (
Optional
[str
], default:'NSC'
) – The ordering of the dimensions in the input, one of “NSC” or “NCS”, where N is the batch dimension, S represents any number of spatial dimensions and C is the channel dimension. Default is “NSC”.out (
Optional
[Array
], default:None
) – optional output arrays, for writing the result to.
- Return type:
Array
- Returns:
ret – The normalized array.
- Container.group_norm(self, num_groups=1, /, *, offset=None, scale=None, eps=1e-05, data_format='NSC', out=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
ivy.Container static method variant of ivy.group_norm. This method simply wraps the function, and so the docstring for ivy.group_norm also applies to this method with minimal changes.
- Parameters:
self (
Union
[Array
,NativeArray
,Container
]) – Input array of default shape (N, *S, C), where N is the batch dimension, *S corresponds to any number of spatial dimensions and C corresponds to the channel dimension.num_groups (
Union
[int
,Container
], default:1
) – number of groups to separate the channels intooffset (
Optional
[Union
[Array
,NativeArray
,Container
]], default:None
) – An offset array of size C. If present, will be added to the normalized input.scale (
Optional
[Union
[Array
,NativeArray
,Container
]], default:None
) – A scale array of size C. If present, the scale is applied to the normalized input.eps (
Union
[float
,Container
], default:1e-05
) – A small float number to avoid dividing by 0.data_format (
Union
[str
,Container
], default:'NSC'
) – The ordering of the dimensions in the input, one of “NSC” or “NCS”, where N is the batch dimension, S represents any number of spatial dimensions and C is the channel dimension. Default is “NSC”.out (
Optional
[Union
[Array
,Container
]], default:None
) – optional output arrays, for writing the result to.
- Return type:
Container
- Returns:
ret – The normalized array.