BatchNorm3d

https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm3d.html

batchnorm3d_demo.py
import svetoviz_webgpu as sv

# 1. Prepare 3D volume (Batch=1, Channels=1, D, H, W)
input_volume = torch.from_numpy(np.stack(slices)).unsqueeze(0).unsqueeze(0)

# 2. Define BatchNorm3d
bn3d = nn.BatchNorm3d(num_features=1)

def terminal_callback(buffer, message, images, files):
    bn3d.train()
    output = bn3d(input_volume)

    buffer.send_system_message(f"Voxel Grid: {list(input_volume.shape)}")
    buffer.send_system_message("Status: Volumetric normalization applied per 3D feature map.")

# 3. Start the interactive session
sv.pytorch_web(module=bn3d, terminal_callback=terminal_callback)
Volumetric Batch Normalization
BatchNorm3d activations
BatchNorm3d extends the logic to 5D tensors $(N, C, D, H, W)$, normalizing over $(N, D, H, W)$ per channel. This is essential for 3D CNNs used in medical imaging and video processing to handle varying voxel intensity ranges.