Neural networks in BESSER.
Model and generate neural networks within the same BESSER low-code workflow. Define your architecture, validate it, and generate runnable PyTorch or TensorFlow code at the click of a button.
Visual NN editor
The BESSER Web Modeling Editor supports the NN diagram type directly in the browser. Layers, tensor operations, datasets and the training configuration can all be dragged and dropped onto the canvas. Code for PyTorch and TensorFlow can then be generated directly from the editor.
- No installation needed
- Drag and drop layers, tensor operations, datasets and configuration
- Generate code directly from the editor
From model to complete code
When Training and Test Dataset are specified in the NN model, the generators produce the full training and evaluation code alongside the network architecture. This covers dataset preparation and preprocessing, loss function and optimizer setup, the training loop, model evaluation and model saving.
- Dataset preparation and preprocessing
- Loss function, optimizer setup and training loop
- Model evaluation and saving
# Define the network architecture
class NeuralNetwork(nn.Module):
def __init__(self):
super().__init__()
self.l1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=(3, 3), stride=(1, 1), padding=0)
self.actv_func_relu = nn.ReLU()
self.l2 = nn.MaxPool2d(kernel_size=(2, 2), stride=(2, 2), padding=0)
self.l3 = nn.Conv2d(in_channels=32, out_channels=64, kernel_size=(3, 3), stride=(1, 1), padding=0)
self.l4 = nn.MaxPool2d(kernel_size=(2, 2), stride=(2, 2), padding=0)
self.l5 = nn.Conv2d(in_channels=64, out_channels=64, kernel_size=(3, 3), stride=(1, 1), padding=0)
self.l6 = nn.Flatten(start_dim=1, end_dim=-1)
self.l7 = nn.Linear(in_features=1024, out_features=64)
self.l8 = nn.Linear(in_features=64, out_features=10)
def forward(self, x):
x = self.l1(x)
x = self.actv_func_relu(x)
x = self.l2(x)
x = self.l3(x)
x = self.actv_func_relu(x)
x = self.l4(x)
x = self.l5(x)
x = self.actv_func_relu(x)
x = self.l6(x)
x = self.l7(x)
x = self.actv_func_relu(x)
x = self.l8(x)
return x
# … plus dataset prep, the training loop, evaluation & model saving And the rest of the toolkit.
Watch it end to end
Model a CIFAR-10 CNN on the canvas, then generate the PyTorch or TensorFlow training code — in one short take.