Location>code7788 >text

A neural network computational graph framework written in C#

Popularity:643 ℃/2024-11-11 13:40:43

preamble

With the continuous development of deep learning technology, neural networks are widely used in various fields. To meet the needs of .NET development, we recommend a neural network computational graph framework written in C#.

The framework is close to PyTorch, providing rich examples and detailed documentation to help you get started quickly.

Framework Introduction

The project is written entirely in C# and provides a transparent framework for neural network computational graphs. Users can view and understand any implementation details inside the framework.

The framework supports a variety of network architectures including Convolutional Neural Networks (CNN), Backpropagation Networks (BP), Fully Connected Networks (FCN), Long Short-Term Memory Networks (LSTM), Convolutional Long Short-Term Memory Networks (ConvLSTM), and Gated Recurrent Unit Networks (GRU).

Each example is accompanied by the required data content to ensure that users can get started and experiment quickly.

Instructions for use

  • Loss function support: MESLOSS, Cross-Entropy Loss (Cross-Entropy)
  • activation function support:ReLU、Tanh、Sigmoid、Softmax
  • Data Type Support: two-dimensional data float[][] and four-dimensional data float[][][,]
  • Pooling Support: Average pooling, maximum pooling
  • Other support: ConvLayer, Conv2DLayer, MulLayer, ConvTranspose2DLayer

Partial code example

//Declare two ConvLayers and an activation function, SigmodLayer.
ConvLayer cl1 = new ConvLayer(13, 5, true);
          
SigmodLayer sl = new SigmodLayer();
float lr = 0.5f;
ConvLayer cl2 = new ConvLayer(5, 1, true);

int i = 0,a=0;
while (a < 5000)
{
     
        dynamic ff = (x);
        ff = (ff);
        ff = (ff);
       
        //calculation error
        MSELoss mloss = new MSELoss();
       
        var loss = (ff, y);

        ("Error." + loss);

        dynamic grid = ();

        //Counterpropagation w2
       
        dynamic w22 = (grid);

        //Counterpropagation W1
        dynamic grid1 = (grid);
        grid1 = (grid1);
        dynamic w11 = (grid1);
           
       //Updating parameters
         = (, (, lr));
         = (, (, lr));

         = (, (, lr));
         = (, (, lr));
        i++;
  
    a++;
}

BP network operation diagram

CNN network 95% recognition success rate

PM2.5 air quality prediction by lstm network

Project Address

Gitee:/UDCS/WeaveAI

ultimate

If you found this article helpful, why not support it with a like? Your support is what keeps me motivated to continue sharing my knowledge. Feel free to leave a comment if you have any questions or need further help.

You can also join WeChat[DotNet Technician] community to share ideas and grow with other tech-loving peers!Excellence is a habit, so feel free to leave a comment and learn!