Features · Neural networks
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.
editor.besser-pearl.org — CIFAR-10 CNN
See it in action
One model. Two frameworks.
The exact CIFAR-10 CNN above, generated as runnable code — PyTorch on the left, TensorFlow on the right. No glue, no rewrites.
generated/pytorch/model.py
# 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 generated/tf/model.py
# Define the network architecture
class NeuralNetwork(tf.keras.Model):
def __init__(self):
super().__init__()
self.l1 = layers.Conv2D(filters=32, kernel_size=(3, 3), strides=(1, 1), padding='valid', activation='relu')
self.l2 = layers.MaxPool2D(pool_size=(2, 2), strides=(2, 2), padding='valid')
self.l3 = layers.Conv2D(filters=64, kernel_size=(3, 3), strides=(1, 1), padding='valid', activation='relu')
self.l4 = layers.MaxPool2D(pool_size=(2, 2), strides=(2, 2), padding='valid')
self.l5 = layers.Conv2D(filters=64, kernel_size=(3, 3), strides=(1, 1), padding='valid', activation='relu')
self.l6 = layers.Flatten()
self.l7 = layers.Dense(units=64, activation='relu')
self.l8 = layers.Dense(units=10, activation=None)
def call(self, x):
x = self.l1(x)
x = self.l2(x)
x = self.l3(x)
x = self.l4(x)
x = self.l5(x)
x = self.l6(x)
x = self.l7(x)
x = self.l8(x)
return x
# … plus dataset prep, the training loop, evaluation & model saving Capabilities
Everything you need to model a network.
Walkthrough
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.
editor.besser-pearl.org — model → generate