fovi.arch.norm
- class fovi.arch.norm.KNNChannelNorm(num_coords, num_channels, device='cuda')[source]
Bases:
LayerNormSimple wrapper to perform normalization over the channel dimension.
- Parameters:
- __init__(num_coords, num_channels, device='cuda')[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class fovi.arch.norm.KNNBatchNorm(num_coords, num_channels, device='cuda')[source]
Bases:
BatchNorm1dSimple wrapper to perform normalization over the batch dimension.
- Parameters:
- class fovi.arch.norm.KNNCoordNorm(num_coords, num_channels, device='cuda')[source]
Bases:
LayerNormSimple wrapper to perform normalization over the coordinate dimension.
- Parameters:
- class fovi.arch.norm.KNNLayerNorm(num_coords, num_channels, device='cuda')[source]
Bases:
LayerNormSimple wrapper to perform normalization over both coordinate and channel dimensions.
- Parameters:
- class fovi.arch.norm.KNNGroupNorm(num_coords, num_channels, base_groups=32, min_channels_per_group=4, device='cuda')[source]
Bases:
GroupNormSimple wrapper to perform group normalization.
- Parameters:
num_coords (int) – Number of coordinates (unused but required for interface).
num_channels (int) – Number of channels to normalize over.
base_groups (int, optional) – Base number of groups. Defaults to 32.
min_channels_per_group (int, optional) – Minimum channels per group. Defaults to 4.
device (str, optional) – Device to place the layer on. Defaults to ‘cuda’.
- fovi.arch.norm.find_valid_num_groups(num_channels, base_groups, min_channels_per_group=4)[source]
Find a valid number of groups for group normalization.
- fovi.arch.norm.get_norm(norm_type, num_coords, num_channels, base_groups=32, min_channels_per_group=4, device='cuda')[source]
Get a normalization layer for a KNN layer with shape (batch, num_channels, num_coords).
- Parameters:
norm_type (str) – Type of normalization (‘layer_chan’, ‘channel’, ‘layer_space’, ‘coord’, ‘layer_all’, ‘layer’, ‘group’, ‘batch’, or ‘none’).
num_coords (int) – Number of coordinates.
num_channels (int) – Number of channels.
base_groups (int, optional) – Base number of groups for group norm. Defaults to 32.
min_channels_per_group (int, optional) – Minimum channels per group. Defaults to 4.
device (str, optional) – Device to place the layer on. Defaults to ‘cuda’.
- Returns:
Normalization layer or None if norm_type is ‘none’.
- Return type:
nn.Module or None
- Raises:
NotImplementedError – If norm_type is not implemented.