def test_add_method(): model = Sequential() model.add(Dense(n_nodes=32, n_inputs=45)) model.build() with pytest.raises(Exception): model.add(Dense(n_nodes=32, n_inputs=45))
from neuralpy.models import Sequential from neuralpy.layers.convolutional import Conv2D from neuralpy.layers.linear import Dense from neuralpy.layers.other import Flatten from neuralpy.layers.activation_functions import ReLU, Softmax from neuralpy.loss_functions import CrossEntropyLoss from neuralpy.optimizer import SGD import torch import torchvision from torchvision import datasets, transforms # Create a Sequential model Instance model = Sequential() #Build your network model.add(Conv2D(input_shape=(1, 28, 28), filters=128, kernel_size=3)) model.add(ReLU()) model.add(Conv2D(filters=64, kernel_size=3)) model.add(ReLU()) model.add(Conv2D(filters=32, kernel_size=3)) model.add(ReLU()) model.add(Flatten()) model.add(Dense(n_nodes=10)) model.build() model.compile(optimizer=SGD(), loss_function=CrossEntropyLoss(), metrics=["accuracy"]) print(model.summary()) #Get the MNIST dataset