System.Numerics.Tensors 9.0.19

About

Provides methods for performing mathematical operations over tensors represented as spans. These methods are accelerated to use SIMD (Single instruction, multiple data) operations supported by the CPU where available.

Key Features

  • Numerical operations on tensors represented as ReadOnlySpan<float>
  • Element-wise arithmetic: Add, Subtract, Multiply, Divide, Exp, Log, Cosh, Tanh, etc.
  • Tensor arithmetic: CosineSimilarity, Distance, Dot, Normalize, Softmax, Sigmoid, etc.

How to Use

using System.Numerics.Tensors;

var movies = new[] {
    new { Title="The Lion King", Embedding= new [] { 0.10022575f, -0.23998135f } },
    new { Title="Inception", Embedding= new [] { 0.10327095f, 0.2563685f } },
    new { Title="Toy Story", Embedding= new [] { 0.095857024f, -0.201278f } },
    new { Title="Pulp Function", Embedding= new [] { 0.106827796f, 0.21676421f } },
    new { Title="Shrek", Embedding= new [] { 0.09568083f, -0.21177962f } }
};
var queryEmbedding = new[] { 0.12217915f, -0.034832448f };

var top3MoviesTensorPrimitives =
    movies
        .Select(movie =>
            (
                movie.Title,
                Similarity: TensorPrimitives.CosineSimilarity(queryEmbedding, movie.Embedding)
            ))
        .OrderByDescending(movies => movies.Similarity)
        .Take(3);

foreach (var movie in top3MoviesTensorPrimitives)
{
    Console.WriteLine(movie);
}

Main Types

The main types provided by this library are:

  • System.Numerics.Tensors.TensorPrimitives

Additional Documentation

Feedback & Contributing

System.Numerics.Tensors is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on System.Numerics.Tensors.

Packages Downloads
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
51
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
50
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
46
Microsoft.Extensions.AI
Utilities for working with generative AI components.
45
Microsoft.Extensions.AI
Utilities for working with generative AI components.
44
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
43
Microsoft.Extensions.AI
Utilities for working with generative AI components.
43
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
42
Microsoft.Extensions.AI
Utilities for working with generative AI components.
42
Microsoft.Extensions.AI
Utilities for working with generative AI components.
41
Microsoft.Extensions.AI
Utilities for working with generative AI components.
40
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
39
Microsoft.Windows.AI.MachineLearning
Microsoft Windows AI Machine Learning APIs. This package provides the Windows ML runtime, ONNX Runtime integration, and DirectML support for Windows desktop applications. Minimum OS: Windows 10 19H1 (Build 18362) or later. For support down to 17763, install Microsoft.WindowsAppSDK.ML.
38
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
37
Microsoft.Extensions.AI
Utilities for working with generative AI components.
37

.NET Framework 4.6.2

.NET 8.0

  • No dependencies.

.NET 9.0

  • No dependencies.

.NET Standard 2.0

Version Downloads Last updated
11.0.0-preview.7.26381.103 14 08/12/2026
11.0.0-preview.6.26359.118 18 07/15/2026
11.0.0-preview.5.26302.115 30 06/11/2026
11.0.0-preview.4.26230.115 29 05/14/2026
11.0.0-preview.3.26207.106 38 04/16/2026
11.0.0-preview.2.26159.112 47 03/12/2026
11.0.0-preview.1.26104.118 40 02/10/2026
10.0.11 12 08/12/2026
10.0.10 16 07/15/2026
10.0.9 19 06/11/2026
10.0.8 36 05/14/2026
10.0.7 41 04/23/2026
10.0.6 44 04/16/2026
10.0.5 43 03/14/2026
10.0.4 25 03/12/2026
10.0.3 44 02/10/2026
10.0.2 48 01/15/2026
10.0.1 50 12/10/2025
10.0.0 41 12/13/2025
10.0.0-rc.2.25502.107 42 12/10/2025
10.0.0-rc.1.25451.107 44 12/11/2025
10.0.0-preview.7.25380.108 41 12/12/2025
10.0.0-preview.6.25358.103 42 12/12/2025
10.0.0-preview.5.25277.114 33 12/10/2025
10.0.0-preview.4.25258.110 39 12/10/2025
10.0.0-preview.3.25171.5 39 12/10/2025
10.0.0-preview.2.25163.2 44 12/13/2025
10.0.0-preview.1.25080.5 37 12/10/2025
9.0.19 10 08/12/2026
9.0.18 17 07/15/2026
9.0.17 21 06/11/2026
9.0.16 27 05/14/2026
9.0.15 42 04/16/2026
9.0.14 39 03/12/2026
9.0.13 45 02/10/2026
9.0.12 42 01/15/2026
9.0.11 46 12/10/2025
9.0.10 45 12/10/2025
9.0.9 45 12/10/2025
9.0.8 45 12/10/2025
9.0.7 41 12/10/2025
9.0.6 48 12/13/2025
9.0.5 47 12/10/2025
9.0.4 36 12/10/2025
9.0.3 47 12/11/2025
9.0.2 47 12/11/2025
9.0.1 44 12/10/2025
9.0.0 45 12/13/2025
9.0.0-rc.2.24473.5 43 12/10/2025
9.0.0-rc.1.24431.7 30 12/13/2025
9.0.0-preview.7.24405.7 43 12/11/2025
9.0.0-preview.6.24327.7 39 12/10/2025
9.0.0-preview.5.24306.7 40 12/10/2025
9.0.0-preview.4.24266.19 47 12/13/2025
9.0.0-preview.3.24172.9 39 12/10/2025
9.0.0-preview.2.24128.5 51 12/10/2025
9.0.0-preview.1.24080.9 42 12/10/2025
8.0.0 35 12/13/2025
8.0.0-rc.2.23479.6 41 12/10/2025
8.0.0-rc.1.23419.4 40 12/13/2025
8.0.0-preview.7.23375.6 36 12/10/2025
8.0.0-preview.6.23329.7 43 12/11/2025
8.0.0-preview.5.23280.8 33 12/13/2025
8.0.0-preview.4.23259.5 43 12/10/2025
8.0.0-preview.3.23174.8 36 12/13/2025
8.0.0-preview.2.23128.3 41 12/10/2025
8.0.0-preview.1.23110.8 40 12/13/2025
7.0.0-rtm.22518.5 42 12/13/2025
7.0.0-rc.2.22472.3 41 12/10/2025
7.0.0-rc.1.22426.10 39 12/10/2025
7.0.0-preview.7.22375.6 37 12/10/2025
7.0.0-preview.6.22324.4 41 12/10/2025
7.0.0-preview.5.22301.12 40 12/10/2025
7.0.0-preview.4.22229.4 43 12/10/2025
7.0.0-preview.3.22175.4 39 12/13/2025
7.0.0-preview.2.22152.2 42 12/10/2025
7.0.0-preview.1.22076.8 36 12/13/2025
6.0.0-rtm.21522.10 39 12/13/2025
6.0.0-rc.2.21480.5 38 12/10/2025
6.0.0-rc.1.21451.13 31 12/10/2025
6.0.0-preview.7.21377.19 40 12/13/2025
6.0.0-preview.6.21352.12 44 12/10/2025
6.0.0-preview.5.21301.5 42 12/13/2025
6.0.0-preview.4.21253.7 41 12/10/2025
6.0.0-preview.3.21201.4 36 12/13/2025
6.0.0-preview.2.21154.6 42 12/10/2025
6.0.0-preview.1.21102.12 40 12/13/2025
5.0.0-preview.8.20407.11 40 12/10/2025
5.0.0-preview.7.20364.11 41 12/13/2025
5.0.0-preview.6.20305.6 32 12/13/2025
5.0.0-preview.5.20278.1 40 12/10/2025
5.0.0-preview.4.20251.6 39 12/10/2025
5.0.0-preview.3.20214.6 39 12/13/2025
5.0.0-preview.2.20160.6 42 12/10/2025
5.0.0-preview.1.20120.5 40 12/10/2025
0.2.0-preview7.19362.9 43 12/10/2025
0.2.0-preview6.19303.8 38 12/10/2025
0.2.0-preview6.19264.9 26 12/10/2025
0.2.0-preview5.19224.8 48 12/10/2025
0.2.0-preview4.19212.13 42 12/11/2025
0.2.0-preview3.19128.7 44 12/10/2025
0.2.0-preview.19073.11 34 12/13/2025
0.2.0-preview.18571.3 46 12/13/2025
0.1.0 45 12/10/2025