This repository contains a Python code snippet that demonstrates the implementation of a simple neural network using the torch library. The code defines a dense (fully connected) layer and applies it to a random input tensor.
The code comprises two primary components:
-
DenseLayer Class: The DenseLayer class represents a single dense (fully connected) layer of a neural network. It initializes the layer with random weights and biases. The forward method performs a forward pass, computing the output of the layer.
-
Example Usage: The code demonstrates how to create an instance of the DenseLayer class and use it to process a random input tensor. It prints the input and the output of the first and second layers to the console.