TensorEngine.Core
1.0.0
dotnet add package TensorEngine.Core --version 1.0.0
NuGet\Install-Package TensorEngine.Core -Version 1.0.0
<PackageReference Include="TensorEngine.Core" Version="1.0.0" />
<PackageVersion Include="TensorEngine.Core" Version="1.0.0" />
<PackageReference Include="TensorEngine.Core" />
paket add TensorEngine.Core --version 1.0.0
#r "nuget: TensorEngine.Core, 1.0.0"
#:package TensorEngine.Core@1.0.0
#addin nuget:?package=TensorEngine.Core&version=1.0.0
#tool nuget:?package=TensorEngine.Core&version=1.0.0
TensorEngine: Custom tensor operation library A high-performance, custom tensor computation engine written in C#. This library provides the fundamental building blocks for numerical computing, including multi-dimensional array management, automatic differentiation through a dynamic computation graph, and broadcasting support
Overview
TensorEngine is a core library designed to implement the tensor operations required for deep learning and advanced scientific computing using C#. At the heart of the engine lie the NDTensor multidimensional array object and the IOperation interface, which defines the forward and backward propagation for operations such as addition and multiplication.
Problem Solved: It enables the concise execution of custom operations and automatic differentiation—tasks that can become complex in existing computing environments—through a clearly defined computation graph structure. In particular, the broadcasting functionality facilitates efficient data manipulation.
Getting Started Prerequisites .NET Core / .NET Runtime (Applicable Target Framework) C# Compiler/IDE
Installation Method
(Note: If this project is not published as a package, the following is a structural description)
Add TensorEngine.Core to your project via NuGet Package Manager.
dotnet add package TensorEngine.Core
Usage The primary workflow for using TensorEngine consists of three steps: defining tensors, constructing the operation graph, and executing backpropagation.
Core Components
NDTensor: A multi-dimensional array node that holds data (real values); it possesses a shape and a rank.
IOperation: An interface that defines rules for operations such as arithmetic; it implements the logic for both the forward pass (PerformForwardPass()) and the backward pass (BackwardPass()).
GradientEngine: An orchestrator responsible for initiating and executing automatic differentiation (backpropagation) across the entire constructed computation graph.
Example: Simple Addition and Backpropagation In this example, we perform an operation to add two tensors and calculate the gradient with respect to the result.
using TensorEngine.Core;
// ... 他の using ...
public void RunExample()
{
// 1. Data preparation (Scalar is a special NDTensor creation method)
var tensorA = NDTensor.Scalar(2.0); // Using a scalar as an example (multidimensional data is used in actual applications)
var tensorB = NDTensor.Scalar(3.0);
// 2. Operation Definition and Graph Construction (Forward Pass)
// NDTensorAddOperation forms the computation graph.
var addOperation = new NDTensorAddOperation(tensorA, tensorB);
NDTensor resultNode = addOperation.PerformForwardPass();
Console.WriteLine($"Result of A + B: {resultNode.GetValue(new int[] { 0 })}"); // Should output 5.0
// 3. Gradient initialization and execution (Backward Pass)
// Set the initial gradient (e.g., all 1s) for the result node and execute the engine.
resultNode.Gradient = new NDTensor(new int[] { 1 }, new double[] { 1.0 });
var engine = new GradientEngine();
engine.ExecuteGraph(resultNode); // Start backpropagation
}
Key Features
Multi-Dimensional Support: Supports tensors of arbitrary rank.
Automatic Differentiation (Autograd): Enables automatic gradient propagation through the computation graph based on IOperation.
Broadcasting Logic: Implements broadcasting operations between tensors of different shapes within NDTensorAddOperation and NDTensorMulOperation.
Issues: 💬 Feedback Please submit feedback, bug reports, and feature requests via the following channels.
- GitHub Issues: [https://github.com/Did9832/TensorEngine.Core/issue]
- Discord: [https://discord.gg/Fc9rmDVBqp]
| Product | Versions 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. |
-
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 |
|---|