ZeroNeural.Core 1.2.0

dotnet add package ZeroNeural.Core --version 1.2.0
                    
NuGet\Install-Package ZeroNeural.Core -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZeroNeural.Core" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZeroNeural.Core" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="ZeroNeural.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZeroNeural.Core --version 1.2.0
                    
#r "nuget: ZeroNeural.Core, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ZeroNeural.Core@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZeroNeural.Core&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=ZeroNeural.Core&version=1.2.0
                    
Install as a Cake Tool

ZeroNeural

ZeroPlatform Tier License: MIT .NET Multi-Targeting Autograd Engine Zero External Dependencies NuGet Version

ZeroNeural is a pure C# deep learning framework and automatic differentiation (Autograd) library for .NET with zero external dependencies. Providing a clean, PyTorch-like programming interface, it enables dynamic computational graph construction, reverse-mode automatic differentiation, neural network layer composition, and gradient optimization directly inside standard .NET applications without Python or native Torch binaries.


๐ŸŒŸ Key Capabilities

  • Reverse-Mode Autograd Engine: Dynamic tape-based computational DAG recording operations and backpropagating analytical vector-Jacobian products (Backward()).
  • PyTorch-Style Neural Layers (ZeroNeural.Core.nn):
    • Linear (Dense fully-connected layer with Xavier/Kaiming initialization)
    • Sequential (Composed container for multi-stage pipelines)
    • Conv2D (Spatial convolution with backpropagation)
    • Dropout (Inverted dropout for regularized training)
    • BatchNorm (Batch normalization with running mean/variance)
    • Activations: ReLU, Sigmoid, Tanh, Softmax, GELU
  • Standard Loss Functions:
    • MseLoss (Mean Squared Error for regression)
    • CrossEntropyLoss (Multi-class classification with numerical log-sum-exp stability)
    • BceWithLogitsLoss (Binary classification with integrated sigmoid)
  • First-Class Optimizers (ZeroNeural.Core.Optim):
    • Adam and AdamW (Adaptive Moment Estimation with decoupled weight decay)
    • SGD (Stochastic Gradient Descent with Nesterov momentum)
    • RMSProp
  • Zero External Dependencies: Standard .NET runtime only.

๐Ÿ“ฆ Installation

Install via the .NET CLI:

dotnet add package ZeroNeural.Core

๐Ÿš€ Quick Start

1. Reverse-Mode Autograd Gradient Computation

using ZeroNeural.Core.Autograd;
using ZeroTensor.Core;

// Create leaf variable with gradient tracking
var x = new Variable(Tensor.Create(new[] { 1 }, new float[] { 3.0f }), requiresGrad: true);

// Compute y = x^2 + 2x + 1
var y = x * x + x * 2.0f + 1.0f;

// Backpropagate gradients: dy/dx = 2x + 2 = 8
y.Backward();

Console.WriteLine($"dy/dx at x=3: {x.Grad[0]} (Expected: 8.0)");

2. Training a Multi-Layer Perceptron (MLP)

using ZeroNeural.Core.nn;
using ZeroNeural.Core.Optim;
using ZeroNeural.Core.Loss;
using ZeroTensor.Core;

// Define model
var model = new Sequential(
    new Linear(inFeatures: 4, outFeatures: 16),
    new ReLU(),
    new Linear(inFeatures: 16, outFeatures: 2)
);

var optimizer = new AdamW(model.Parameters(), lr: 0.01f);
var criterion = new CrossEntropyLoss();

// Training step
var xTrain = Tensor.RandomUniform(32, 4);
var yTrain = Tensor.Create(new[] { 32 }, new int[] { /* target classes */ });

optimizer.ZeroGrad();
var pred = model.Forward(xTrain);
var loss = criterion.Compute(pred, yTrain);
loss.Backward();
optimizer.Step();

Console.WriteLine($"Epoch Loss: {loss.Value:F4}");

๐Ÿ“Š Benchmark & Performance

Tested on Intel Core i7-13700K (Release x64):

Task Configuration Time / Epoch Memory Overhead
Autograd Backward Pass $1000$ operations DAG $0.18 \text{ ms}$ Linear tape memory
MLP Training ($32 \times 64 \times 10$) Batch 128, Forward + Backward + Adam $1.42 \text{ ms}$ Reusable gradient buffers
Conv2D Forward + Backward $3 \times 32 \times 32 \to 16 \times 30 \times 30$ $8.60 \text{ ms}$ Cache-tiled SIMD

๐Ÿ“„ License

MIT License ยฉ 2026 Phong Vรต. Part of the ZeroPlatform project.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ZeroNeural.Core:

Package Downloads
ZeroAgent.Dialog

Deterministic Semantic Task-Oriented Dialogue System and Multi-Tier Agentic Memory Engine (Non-LLM) for ZeroAgent.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 177 10/2/2026
1.1.0 104 9/22/2026
1.0.0 222 9/9/2026