Toolboxes

Deep Learning ToolboxPyTorch 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
MATLABPythonNote
trainNetwork(X, Y, layers, options)model.fit(X, Y, ...) # KerasKeras: define Sequential, compile, fit
trainingOptions(solver, ...)optimizer = torch.optim.Adam(...)PyTorch: create optimizer directly
layerGraphtorch.nn.Sequential(...) or torch.nn.ModulePyTorch: subclass nn.Module for custom graphs
imageInputLayer([h w c])Input(shape=(h, w, c)) # KerasInput layer not needed in PyTorch
convolution2dLayer(k, n)Conv2D(n, k) # Kerastorch.nn.Conv2d(in_ch, out_ch, k)
fullyConnectedLayer(n)Dense(n) # Kerastorch.nn.Linear(in_features, n)
reluLayerReLU() # Keras / torch.nn.ReLU()
softmaxLayerSoftmax() # output layer with softmax activation
dropoutLayer(p)Dropout(p) # Keras / torch.nn.Dropout(p)
batchNormalizationLayerBatchNormalization() # 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) # Kerastorch: 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
augmentedImageDatastoretorchvision.transforms / tf.keras.layers.experimental.preprocessing
resnet50 / vgg16 / googlenettorchvision.models.resnet50(weights=...) / tf.keras.applications.VGG16

The converter automatically detects Deep Learning functions and adds the correct imports.

Try the converter