Toolboxes
Deep Learning Toolbox → PyTorch or TensorFlow/Keras
MATLAB's neural network stack. No 1:1 function mapping — deep learning frameworks differ in their whole mental model. Use PyTorch if you prefer defining layers in code; TensorFlow/Keras if you prefer a declarative builder. Both are mature, free, and dominant in research.
Install
pip install torch # or: pip install tensorflow| MATLAB | Python | Note |
|---|---|---|
| trainNetwork(X, Y, layers, options) | model.fit(X, Y, ...) # Keras | Keras: define Sequential, compile, fit |
| trainingOptions(solver, ...) | optimizer = torch.optim.Adam(...) | PyTorch: create optimizer directly |
| layerGraph | torch.nn.Sequential(...) or torch.nn.Module | PyTorch: subclass nn.Module for custom graphs |
| imageInputLayer([h w c]) | Input(shape=(h, w, c)) # Keras | Input layer not needed in PyTorch |
| convolution2dLayer(k, n) | Conv2D(n, k) # Keras | torch.nn.Conv2d(in_ch, out_ch, k) |
| fullyConnectedLayer(n) | Dense(n) # Keras | torch.nn.Linear(in_features, n) |
| reluLayer | ReLU() # Keras / torch.nn.ReLU() | |
| softmaxLayer | Softmax() # output layer with softmax activation | |
| dropoutLayer(p) | Dropout(p) # Keras / torch.nn.Dropout(p) | |
| batchNormalizationLayer | BatchNormalization() # Keras / torch.nn.BatchNorm2d | |
| maxPooling2dLayer(k) | MaxPooling2D(k) # Keras / torch.nn.MaxPool2d(k) | |
| lstmLayer(n) | LSTM(n) # Keras / torch.nn.LSTM(input_size, n) | |
| classify(net, X) | model.predict(X) # Keras | torch: model(X).argmax(dim=1) |
| predict(net, X) | model.predict(X) # Keras / model(X) for torch | |
| imageDatastore(folder) | torchvision.datasets.ImageFolder / tf.keras.utils.image_dataset_from_directory | |
| augmentedImageDatastore | torchvision.transforms / tf.keras.layers.experimental.preprocessing | |
| resnet50 / vgg16 / googlenet | torchvision.models.resnet50(weights=...) / tf.keras.applications.VGG16 |
The converter automatically detects Deep Learning functions and adds the correct imports.
Try the converter