sage.architecture.frontend.mscnn1d
Filename = Foobar.py Description = Lorem ipsum dolor sit amet
Created on Tue Nov 21 17:19:53 2021
__author__ = Narenraju Nagarajan __copyright__ = Copyright 2021, Sage __credits__ = nnarenraju __license__ = MIT Licence __version__ = 0.0.1 __maintainer__ = Narenraju Nagarajan __email__ = nagarajan@uni-potsdam.de __status__ = [‘inProgress’, ‘Archived’, inUsage, ‘Debugging’]
Github Repository: NULL
Documentation
Classes
1D convolution with |
|
Multi-scale inception-style block with five parallel convolutions. |
|
Three-stage multi-scale 1D CNN frontend for a single detector channel. |
Module Contents
- class Conv1dSame(in_channels, out_channels, kernel_size, stride=1, dilation=1, groups=1, bias=True)[source]
Bases:
torch.nn.Conv1d1D convolution with
padding='same'semantics.Thin wrapper around
torch.nn.Conv1dthat always requestspadding='same', ensuring the output length matches the input length regardless of kernel size or dilation.Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class ConcatBlockConv5(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, act=nn.SiLU)[source]
Bases:
torch.nn.ModuleMulti-scale inception-style block with five parallel convolutions.
Applies five 1D convolutions in parallel at scales
k,2k,k//2,k//4, and4k, concatenates their outputs together with the identity skip connection, then fuses with a 1×1 pointwise convolution. This allows each block to capture temporal features across a wide range of time scales simultaneously — critical for gravitational-wave signals whose frequency sweeps from low to high over hundreds of milliseconds.- Parameters:
in_channels (int) – Number of input channels.
out_channels (int) – Number of output channels per parallel branch (and the final output).
kernel_size (int) – Base kernel size (
k). The five branches usek,2k,k//2,k//4, and4k.stride (int) – Stride for all parallel convolutions (default 1).
act (callable) – Activation class to instantiate (default
nn.SiLU).state (Initialize internal Module)
ScriptModule. (shared by both nn.Module and)
- class ConvBlock(filters_start=32, kernel_start=64, in_channels=1)[source]
Bases:
torch.nn.ModuleThree-stage multi-scale 1D CNN frontend for a single detector channel.
Processes one detector’s time-domain waveform through three successive
ConcatBlockConv5pairs with decreasing kernel scales and interleaved downsampling:Stage 1: kernels
k,k//2+1→ MaxPool1d(8) (8× downsample)Stage 2: kernels
k//2+1,k//4+1→ MaxPool1d(4) (4× downsample)Stage 3: kernels
k//4+1,k//4+1(no spatial downsample)
Output is unsqueezed to add a height dimension, converting the 1D time-series into a 2D feature map
(B, 1, C, T_down)suitable for the 2D ResNet backend.- Parameters: