-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IROTensor,ITensor,Tensor API updates
- Loading branch information
1 parent
7435fb7
commit dfc0745
Showing
11 changed files
with
537 additions
and
181 deletions.
There are no files selected for viewing
161 changes: 112 additions & 49 deletions
161
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
46 changes: 46 additions & 0 deletions
46
...ies/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Common/IReadOnlyTensor.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,46 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Buffers; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace System.Numerics.Tensors | ||
{ | ||
public interface IReadOnlyTensor<TSelf, T> : IEnumerable<T> | ||
where TSelf : IReadOnlyTensor<TSelf, T> | ||
{ | ||
static abstract TSelf? Empty { get; } | ||
|
||
bool IsEmpty { get; } | ||
bool IsPinned { get; } | ||
nint FlattenedLength { get; } | ||
int Rank { get; } | ||
|
||
T this[params ReadOnlySpan<nint> indexes] { get; } | ||
T this[params ReadOnlySpan<NIndex> indexes] { get; } | ||
TSelf this[params scoped ReadOnlySpan<NRange> ranges] { get; } | ||
|
||
ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(); | ||
ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<nint> start); | ||
ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<NIndex> startIndex); | ||
ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<NRange> range); | ||
|
||
void CopyTo(TensorSpan<T> destination); | ||
void FlattenTo(Span<T> destination); | ||
|
||
// These are not properties so that structs can implement the interface without allocating: | ||
void GetLengths(Span<nint> destination); | ||
void GetStrides(Span<nint> destination); | ||
|
||
ref readonly T GetPinnableReference(); | ||
TSelf Slice(params scoped ReadOnlySpan<nint> start); | ||
TSelf Slice(params scoped ReadOnlySpan<NIndex> startIndex); | ||
TSelf Slice(params scoped ReadOnlySpan<NRange> range); | ||
bool TryCopyTo(TensorSpan<T> destination); | ||
bool TryFlattenTo(Span<T> destination); | ||
} | ||
} |
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
Oops, something went wrong.