N Neurarch Architectures Checks Docs Open the app

Architectures / Time-series

๐Ÿ“ˆ 1D CNN + LSTM

Conv1D + LSTM baseline for ECG/PPG/IMU and other long-form physio signals

Layers
13
Parameters
886.2K
Input
12 ร— 5000
Output
5
Verifier
Clean

Every number on this page is computed from the graph by the same functions the app runs, not written by hand.

Open 1D CNN + LSTM on the canvas Free, no account needed

When to pick it

Pick for long-form 1D physiological signals (ECG, PPG, IMU) where local morphology + temporal context both matter. Solid baseline before reaching for transformers.

Structure

13 layers. Output shapes are propagated from the input shape, batch dimension excluded.

LayerTypeParametersOutput shape
1ts_windowInputshape=[12, 5000]12 ร— 5000
2conv1Conv1DoutChannels=64, kernelSize=7, stride=164 ร— 5000
3bnBatchNormnormalizedShape=6464 ร— 5000
4actReLU64 ร— 5000
5poolMaxPool1DkernelSize=2, stride=264 ร— 2500
6conv2Conv1DoutChannels=128, kernelSize=5, stride=1128 ร— 2500
7bnBatchNormnormalizedShape=128128 ร— 2500
8actReLU128 ร— 2500
9poolMaxPool1DkernelSize=2, stride=2128 ร— 1250
10lstmLSTMinFeatures=128, hiddenSize=128, numLayers=2128
11dropDropoutp=0.3128
12classifierLinearoutFeatures=55
13logitsOutput5

What the verifier says

The same 41 structural checks that run on every edit in the app, on this graph.

No finding. Shapes propagate end to end, every divisibility condition holds, and no advisory rule fires. See the checks.

The PyTorch it exports

Generated from the graph above. First 46 lines; the app exports the whole file, plus the training loop, the data contract and a deploy bundle.

# Architecture designed with Neurarch: https://neurarch.com
# PyTorch: compatible with Python 3.8+ and torch>=1.12
# Colab: pip install torch torchvision  (usually pre-installed)

import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple

class _1DCNNLSTM(nn.Module):
    def __init__(self):
        super().__init__()

        self.conv1d_1 = nn.Conv1d(12, 64, kernel_size=7, stride=1, padding=3)
        self.batchNorm_1 = nn.BatchNorm1d(64)
        self.maxpool1d_1 = nn.MaxPool1d(kernel_size=2, stride=2)
        self.conv1d_2 = nn.Conv1d(64, 128, kernel_size=5, stride=1, padding=2)
        self.batchNorm_2 = nn.BatchNorm1d(128)
        self.maxpool1d_2 = nn.MaxPool1d(kernel_size=2, stride=2)
        self.lstm_1 = nn.LSTM(1250, 128, num_layers=2, batch_first=True)
        self.dropout_1 = nn.Dropout(p=0.3)
        self.linear_1 = nn.Linear(128, 5)

    def forward(self, x):
        # ts_window shape: [12,5000]
        conv1d_conv_1 = self.conv1d_1(x)
        batch_norm_bn_1 = self.batchNorm_1(conv1d_conv_1)
        relu_relu_1 = F.relu(batch_norm_bn_1)
        maxpool1d_pool_1 = self.maxpool1d_1(relu_relu_1)
        conv1d_conv_2 = self.conv1d_2(maxpool1d_pool_1)
        batch_norm_bn_2 = self.batchNorm_2(conv1d_conv_2)
        relu_relu_2 = F.relu(batch_norm_bn_2)
        maxpool1d_pool_2 = self.maxpool1d_2(relu_relu_2)
        lstm_lstm_1 = self.lstm_1(maxpool1d_pool_2)[0][:, -1, :]
        dropout_drop_1 = self.dropout_1(lstm_lstm_1)
        linear_near_1 = self.linear_1(dropout_drop_1)
        # Output
        return linear_near_1


if __name__ == '__main__':
    model = _1DCNNLSTM()
    model.eval()

    x = torch.randn(1, 12, 5000)  # (batch, seq_len, embed_dim)
    with torch.no_grad():

For agents

This architecture is machine-readable end to end. An agent can list the set, fetch this graph, edit it, and have the edit verified before any GPU time is spent.

Also in Time-series

๐Ÿ“ˆ PatchTST
Channel-independent patching + Transformer for multivariate time-series
19 layers ยท 395.4K