ravin-d-27 / PyDeepFlow

This is my own Deep Learning Package, optimized for performing Deep Learning Tasks and easy to learn and integrate into projects.
https://pypi.org/project/pydeepflow/
MIT License
18 stars 8 forks source link

Added Batch Normalization to Multi_Layer_ANN Model #36

Closed vaish-navi-n closed 1 month ago

vaish-navi-n commented 1 month ago

Description

This PR implements Batch Normalization between the hidden layers of the Multi_Layer_ANN model to enhance training stability and speed. The implementation is compatible with both CPU (NumPy) and GPU (CuPy) environments, ensuring versatility across different hardware setups.

Fixes #4

Changes Overview

Key Implementation Details

  1. BatchNormalization class:

    • Initializes parameters (gamma, beta) and running statistics
    • Implements forward pass with training and inference modes
    • Implements backward pass for gradient computation
  2. Multi_Layer_ANN modifications:

    • Added use_batch_norm parameter to include batch normalization in the model initialization
    • Modified layer structure to incorporate batch normalization layers
    • Updated forward and backward propagation to handle batch normalization

Testing

ravin-d-27 commented 1 month ago

Hi @vaish-navi-n ! Thank you for your contribution !