-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/8.0' into darc-release/8.0-303af298-a10b-4c80-8…
…b1f-7ff52ba3641e
- Loading branch information
Showing
26 changed files
with
17,829 additions
and
2,791 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/libraries/System.Globalization/tests/CultureInfo/CultureInfoGetCultures.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Xunit; | ||
|
||
namespace System.Globalization.Tests | ||
{ | ||
public class CultureInfoGetCultures | ||
{ | ||
[Fact] | ||
public void GetSpecificCultures() | ||
{ | ||
var specificCultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures); | ||
Assert.True(specificCultures.Length > 0); | ||
Assert.All(specificCultures, c => Assert.True(c.IsNeutralCulture == false)); | ||
} | ||
|
||
[Fact] | ||
public void GetAllCultures() | ||
{ | ||
var allCultures = CultureInfo.GetCultures(CultureTypes.AllCultures); | ||
Assert.True(allCultures.Length > 0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
## 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 | ||
|
||
```C# | ||
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 | ||
|
||
* [API documentation](https://learn.microsoft.com/en-us/dotnet/api/system.numerics.tensors) | ||
|
||
## Feedback & Contributing | ||
|
||
System.Numerics.Tensors is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime). |
2 changes: 2 additions & 0 deletions
2
src/libraries/System.Numerics.Tensors/src/ReferenceAssemblyExclusions.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
M:System.Numerics.Tensors.TensorPrimitives.ConvertToHalf(System.ReadOnlySpan{System.Single},System.Span{System.Half}) | ||
M:System.Numerics.Tensors.TensorPrimitives.ConvertToSingle(System.ReadOnlySpan{System.Half},System.Span{System.Single}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.