from nnfs.datasets import spiral_data import numpy as np import nnfs import matplotlib.pyplot as plt #sets random seed to zero, float 32 dtype default, overrides original dot product from numpy nnfs.init() class Layer_Dense: #layer initialization def __init__(self, n_inputs, n_neurons): #random initialization of weights and biases self.weights = 0.01 * np.random.randn(n_inputs, n_neurons) self.biases = np.zeros((1, n_neurons)) #forward pass def forward(self, inputs): #calculate outputs from inputs weights and biases self.output = np.dot(inputs, self.weights) + self.biases