NDTensorEngine 1.0.1

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package NDTensorEngine --version 1.0.1
                    
NuGet\Install-Package NDTensorEngine -Version 1.0.1
                    
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="NDTensorEngine" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NDTensorEngine" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="NDTensorEngine" />
                    
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 NDTensorEngine --version 1.0.1
                    
#r "nuget: NDTensorEngine, 1.0.1"
                    
#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 NDTensorEngine@1.0.1
                    
#: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=NDTensorEngine&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=NDTensorEngine&version=1.0.1
                    
Install as a Cake Tool

NDTensor Engine: High-Performance Tensor Operations and Automatic Differentiation Library

Overview

The NDTensor Engine is a custom, highly efficient numerical computation framework designed for the C#/.NET environment. At its core is the NDTensor class, which represents multidimensional arrays (tensors) and provides basic linear algebra operations, element-by-element operations with broadcasting capabilities, and a complete Automatic Differentiation (Autograd) system.

This library is designed as a foundation for low-level control and implementation of gradient-based optimization processes in deep learning models and complex scientific computing.

Getting Started

Prerequisites

  • .NET Core / .NET Runtime (Recommended version: [Insert appropriate runtime version])
  • C# compiler and development environment (Visual Studio, VS Code, etc.)

Installation

This package is intended for installation via NuGet.

dotnet add package NDTensorEngine

Usage & Core Concepts

The use of NDTensor Engine is primarily based on the following three core concepts:

1. NDTensor (The Computational Node)

NDTensor holds the value itself and the shape used to store that value. Internally, it manages data as a flat one-dimensional array, and multi-dimensional access is achieved by computed stride.

// Example of initializing a tensor with shape [2, 2] (data is set manually)
double[] data = new double[] { 1.0, 2.0, 3.0, 4.0 };
var M = new NDTensor(new int[] { 2, 2 }, data);
// Get the value of a specific multidimensional coordinate (e.g., Row 1, Col 0)
int[] indices = new int[] { 1, 0 };
double value = M.GetValue(indices); // Result: 3.0

2. Broadcasting Logic (Extended Operations)

One of the most powerful features of this library is the "broadcast" function in tensor addition and multiplication. When two tensors with different shapes are used as the targets of an operation, the tensor with a dimension of size 1 (scalar behavior) or a tensor with a smaller dimension is automatically extended to match the larger target shape, and element-wise calculations are performed. Example: Matrix + Scalar When adding a single scalar value (represented as shape[1]) to a 2x2 matrix, the scalar is added to all elements.

3. Autograd (Automatic Differentiation and Backpropagation)

NDTensor holds gradient information (Gradient), and the operator (IOperation) maintains its computation history.

  • Forward Pass: Performs the calculation $C = A \text{ op } B$ and outputs a new tensor $C$.

  • Backward Pass: When the loss gradient (e.g., 1.0 for all elements) is passed to the final output, the engine automatically and cumulatively calculates the gradients $\frac{\partial L}{\partial A}$ and $\frac{\partial L}{\partial B}$ for each input tensor using the chain rule based on the operator definition, and applies them to the original parameters (NDTensor).

// Forward propagation execution and history recording
var productOp = new NDTensorMulOperation(W, X);
var P = productOp.PerformForwardPass(); // ★Broadcast is executed here★
P.RecordOperation(productOp);

// Trigger backpropagation (pass the derivative with respect to the loss)
Y.SetDataInPlace(initialGradientForY);
var engine = new GradientEngine();
engine.ExecuteGraph(Y); // Gradient is accumulated on W, X

Additional Documentation

  • [Internal Implementation Details Documentation (Assuming GitHub Link)]: Details of stride calculation and broadcast dimensional consistency checking logic.
  • [Operator Interface Definition (IOperation)]: Specifications on how to implement each mathematical function (addition, multiplication, etc.).

💬 Feedback

Please send your opinions, bug reports, and feature requests through the following channels.

  • GitHub Issues: [https://github.com/Did9832/NDTensorEngine/issues]
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated