Dropout1d

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

dropout1d_demo.py
import svetoviz_webgpu as sv

# 1. Prepare 1D Signal (Batch=1, Channels=4, Length=8)
input_tensor = torch.ones(1, 4, 8)

# 2. Define Dropout1d (Spatial Dropout)
dropout = nn.Dropout1d(p=0.5)

def terminal_callback(buffer, message, images, files):
    dropout.train()
    output = dropout(input_tensor)

    # Check which entire channels are zeroed
    channel_sums = output.sum(dim=2).squeeze()
    active_channels = (channel_sums > 0).sum().item()

    buffer.send_system_message(f"Active Channels: {active_channels} / 4")
    buffer.send_system_message("Logic: Entire 1D feature maps are dropped, not just individual pixels.")

# 3. Start the interactive session
sv.pytorch_web(module=dropout, terminal_callback=terminal_callback)
Channel-Level Dropout
Dropout1d activations
Dropout1d (often called Spatial Dropout) zeroes out entire channels rather than individual elements. In sequence data, adjacent pixels are highly correlated; standard dropout is ineffective because the model can "learn" around missing pixels. Dropping the whole channel forces independence.