Skip to main content

PyTorch

Layer, model and training nodes.

18 nodes. Right-click any node in the editor to read this documentation in the app.

Torch​

〰️ Activation Layer​

id torch_activation_layer · Torch · Python export: yes

Element-wise activation function, chosen from a list: ReLU, Sigmoid or Tanh.

Inputs

PortTypeDescription
upstreamLayerPrevious layer. Leave unconnected for the model's first layer.

Outputs

PortTypeDescription
layerLayerThe chosen activation.

Fields

FieldTypeDefaultChoices
Activationselectrelurelu, sigmoid, tanh

➕ Add Merge​

id torch_add_merge · Torch · Python export: yes

Sum two or more branches element-wise — the residual / skip connection: output = main(x) + shortcut(x). Branch shapes must match.

Inputs

PortTypeDescription
branch_1LayerBranch 1 to add (required).
branch_2LayerBranch 2 to add (required).
branch_3LayerBranch 3 to add (optional).
branch_4LayerBranch 4 to add (optional).

Outputs

PortTypeDescription
layerLayerSum of the connected branches.

📶 BatchNorm2D Layer​

id torch_batchnorm2d_layer · Torch · Python export: yes

Batch normalisation over the channels of a [batch, channels, H, W] tensor. Channels must equal the preceding Conv2D's out_channels.

Inputs

PortTypeDescription
upstreamLayerPrevious layer. Leave unconnected for the model's first layer.
num_featuresintNumber of channels (overrides the num_features field). Overrides the Channels (= out_channels of prev Conv) field when connected.

Outputs

PortTypeDescription
layerLayerBatchNorm2d layer.

Fields

FieldTypeDefaultChoices
Channels (= out_channels of prev Conv)int16

🔀 Concat Merge​

id torch_cat_merge · Torch · Python export: yes

Concatenate two or more branches along a dimension (Inception / DenseNet style). Dim 1 is the channel axis of [B, C, H, W] tensors; other dimensions must match.

Inputs

PortTypeDescription
branch_1LayerBranch 1 to concatenate (required).
branch_2LayerBranch 2 to concatenate (required).
branch_3LayerBranch 3 to concatenate (optional).
branch_4LayerBranch 4 to concatenate (optional).

Outputs

PortTypeDescription
layerLayerThe branches concatenated along dim.

Fields

FieldTypeDefaultChoices
Concat dimint1

🔲 Conv2D Layer​

id torch_conv2d_layer · Torch · Python export: yes

2-D convolution over [batch, channels, height, width] images. Padding 'same' keeps height and width unchanged.

Inputs

PortTypeDescription
upstreamLayerPrevious layer. Leave unconnected for the model's first layer.
in_channelsintChannels coming in (overrides the in_channels field). Overrides the In channels field when connected.
out_channelsintChannels going out (overrides the out_channels field). Overrides the Out channels field when connected.
kernel_sizeintSquare kernel side length (overrides the kernel_size field). Overrides the Kernel size field when connected.

Outputs

PortTypeDescription
layerLayerConv2d layer, ready to chain or feed a Sequential / Graph Model.

Fields

FieldTypeDefaultChoices
In channelsint3
Out channelsint16
Kernel sizeint3
Paddingselect00, 1, 2, 3, same

🎲 Dropout Layer​

id torch_dropout_layer · Torch · Python export: yes

Randomly zeroes a fraction p of activations during training to reduce over-fitting; does nothing at evaluation time.

Inputs

PortTypeDescription
upstreamLayerPrevious layer. Leave unconnected for the model's first layer.
pfloatProbability of zeroing each activation (0-1) (overrides the p field). Overrides the Drop probability field when connected.

Outputs

PortTypeDescription
layerLayerDropout layer.

Fields

FieldTypeDefaultChoices
Drop probabilityfloat0.5

📦 Export ONNX​

id torch_export_onnx · Torch · Python export: yes

Export the model to an ONNX file, tracing it with a random dummy input of the given shape (batch, channels, height, width).

Inputs

PortTypeDescription
modelModuleModel to export.

Outputs

PortTypeDescription
pathstrPath of the exported .onnx file.

Fields

FieldTypeDefaultChoices
Pathtextmodel.onnx
Dummy input shapetext1,3,32,32

📏 Flatten Layer​

id torch_flatten_layer · Torch · Python export: yes

Flatten everything except the batch dimension, e.g. [B, C, H, W] -> [B, CHW]. Put it between conv and linear layers.

Inputs

PortTypeDescription
upstreamLayerPrevious layer. Leave unconnected for the model's first layer.

Outputs

PortTypeDescription
layerLayerFlatten layer.

🕸 Graph Model​

id torch_graph_model · Torch · Python export: yes

Assemble a whole network from wired-together layer nodes. Connect the FINAL layer(s) of your design; the node traces every upstream connection (chains, residual skips, concatenations) and wraps the graph as one model.

Inputs

PortTypeDescription
output_1LayerFinal layer of the network.
output_2LayerAdditional output layer (optional).
output_3LayerAdditional output layer (optional).
output_4LayerAdditional output layer (optional).

Outputs

PortTypeDescription
modelModuleThe assembled model (single output tensor, or a tuple for several outputs).

➖ Linear Layer​

id torch_linear_layer · Torch · Python export: yes

Fully-connected layer: y = xW + b, mapping in_features inputs to out_features outputs.

Inputs

PortTypeDescription
upstreamLayerPrevious layer. Leave unconnected for the model's first layer.
in_featuresintInput size (overrides the in_features field). Overrides the In features field when connected.
out_featuresintOutput size (overrides the out_features field). Overrides the Out features field when connected.

Outputs

PortTypeDescription
layerLayerLinear layer, ready to chain or feed a Sequential / Graph Model.

Fields

FieldTypeDefaultChoices
In featuresint128
Out featuresint10

⬇️ MaxPool2D Layer​

id torch_maxpool2d_layer · Torch · Python export: yes

2-D max pooling: keeps the largest value in each window, shrinking height and width (stride 2 halves them).

Inputs

PortTypeDescription
upstreamLayerPrevious layer. Leave unconnected for the model's first layer.
kernel_sizeintPooling window side length (overrides the kernel_size field). Overrides the Kernel size field when connected.
strideintStep between windows (overrides the stride field). Overrides the Stride field when connected.

Outputs

PortTypeDescription
layerLayerMaxPool2d layer.

Fields

FieldTypeDefaultChoices
Kernel sizeint2
Strideint2

📚 MNIST Dataset​

id mnist_dataset · Torch · Python export: yes

The MNIST handwritten-digit training set as a DataLoader (batches of 32: images shaped [32, 1, 28, 28], integer labels 0-9). Downloads to ./data on first use, so it needs network access once.

Outputs

PortTypeDescription
datasetDataLoaderBatches of (image tensor, label) — wire into Train Image Classifier.

📈 ReLU Layer​

id torch_relu_layer · Torch · Python export: yes

ReLU activation: max(0, x), element-wise.

Inputs

PortTypeDescription
upstreamLayerPrevious layer. Leave unconnected for the model's first layer.

Outputs

PortTypeDescription
layerLayerReLU activation.

💾 Save Model​

id torch_save_model · Torch · Python export: yes

Save the model's weights (state_dict) to a .pt file and pass the model through unchanged.

Inputs

PortTypeDescription
modelModuleModel whose weights to save.

Outputs

PortTypeDescription
modelModuleThe input model, unchanged.

Fields

FieldTypeDefaultChoices
Pathtextmodel.pt

🧱 Sequential​

id torch_sequential · Torch · Python export: yes

Chain layers, in port order, into a plain nn.Sequential model. Wire layers into layer_1, layer_2, ... For branching / residual designs use Graph Model instead.

Inputs

PortTypeDescription
layer_1LayerLayer number 1 in the chain (optional).
layer_2LayerLayer number 2 in the chain (optional).
layer_3LayerLayer number 3 in the chain (optional).
layer_4LayerLayer number 4 in the chain (optional).
layer_5LayerLayer number 5 in the chain (optional).
layer_6LayerLayer number 6 in the chain (optional).
layer_7LayerLayer number 7 in the chain (optional).
layer_8LayerLayer number 8 in the chain (optional).

Outputs

PortTypeDescription
modelModulenn.Sequential of the connected layers.

🧪 Simple CNN​

id torch_simple_cnn · Torch · Python export: yes

A complete small image classifier in one node, for when you don't want to wire layers by hand: Conv2D (same padding) -> ReLU -> 2x2 MaxPool -> Flatten -> Linear. Set the image channels and size, the number of filters and kernel size, and the number of classes; the layer sizes are worked out for you. For anything deeper or branching, build the network from the layer nodes.

Inputs

PortTypeDescription
in_channelsintImage channels (1 = greyscale, 3 = RGB) (overrides the in_channels field). Overrides the Image channels field when connected.
image_sizeintImage height and width in pixels (square images) (overrides the image_size field). Overrides the Image size (px) field when connected.
conv_channelsintNumber of convolution filters (overrides the conv_channels field). Overrides the Conv filters field when connected.
kernel_sizeintSquare kernel side length (overrides the kernel_size field). Overrides the Kernel size field when connected.
num_classesintNumber of output classes (overrides the num_classes field). Overrides the Classes field when connected.

Outputs

PortTypeDescription
modelModulenn.Sequential classifier — wire into Train Image Classifier.

Fields

FieldTypeDefaultChoices
Image channelsint1
Image size (px)int28
Conv filtersint16
Kernel sizeint3
Classesint10

🔥 Tensor​

id torch_tensor · Torch · Python export: yes

Convert an array, DataFrame or list into a float32 torch tensor.

Inputs

PortTypeDescription
datandarray | DataFrame | listData to convert.

Outputs

PortTypeDescription
tensorTensorfloat32 tensor with the same shape as the data.

🏋️ Train Image Classifier​

id torch_train_image_classifier · Torch · Python export: yes

Train a model as an image classifier: Adam optimiser, cross-entropy loss, one pass over the DataLoader per epoch. Reports progress per epoch / batch and outputs the trained model.

Inputs

PortTypeDescription
modelModuleModel to train (Sequential or Graph Model).
datasetDataLoaderBatches of (inputs, integer class labels).
lrfloatAdam learning rate (overrides the lr field). Overrides the Learning rate field when connected.
epochsintNumber of passes over the data (overrides the epochs field). Overrides the Epochs field when connected.

Outputs

PortTypeDescription
modelModuleThe model after training (same object, updated in place).

Fields

FieldTypeDefaultChoices
Epochsint1
Learning ratefloat0.001