9 instantiations of TensorShape
System.Numerics.Tensors (9)
System\Numerics\Tensors\netcore\TensorShape.cs (9)
729
TensorShape result = new
TensorShape
(
828
TensorShape result = new
TensorShape
(linearLength - computedOffset, lengths, strides, TensorFlags.None);
853
return new
TensorShape
(linearLength: -1, lengths: lengths, strides: strides, flags: flags);
861
return new
TensorShape
(
876
return new
TensorShape
(array.Length, lengths, strides, TensorFlags.None);
898
return new
TensorShape
(linearLength, lengths, strides, TensorFlags.None);
919
return new
TensorShape
(
939
return new
TensorShape
(linearLength, lengths, strides, flags);
1143
TensorShape result = new
TensorShape
(
107 references to TensorShape
System.Numerics.Tensors (107)
System\Numerics\Tensors\netcore\ReadOnlyTensorDimensionSpan_1.cs (2)
20
private readonly
TensorShape
_sliceShape;
33
_sliceShape =
TensorShape
.Create((dimension != tensor.Rank) ? tensor.Lengths[dimension..] : [1], tensor.Strides[dimension..], tensor.IsPinned);
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (21)
32
internal readonly
TensorShape
_shape;
43
_shape =
TensorShape
.Create(array);
78
_shape =
TensorShape
.Create(array, lengths, strides);
102
_shape =
TensorShape
.Create(array, start, lengths, strides);
114
_shape =
TensorShape
.Create(ref reference, span.Length, pinned: false);
144
_shape =
TensorShape
.Create(ref reference, span.Length, lengths, strides, pinned: false);
156
_shape =
TensorShape
.Create(array);
183
_shape =
TensorShape
.Create(array, start, lengths, strides, out nint linearOffset);
198
_shape =
TensorShape
.Create(data, dataLength);
237
_shape =
TensorShape
.Create(data, dataLength, lengths, strides);
243
_shape =
TensorShape
.Create(ref data, dataLength, lengths, strides, pinned);
247
internal ReadOnlyTensorSpan(ref T reference, scoped in
TensorShape
shape)
256
get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<
TensorShape
.GetOffsetAndLengthForNInt, nint>(indexes));
262
get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(indexes));
388
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
398
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
408
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
422
if (
TensorShape
.AreCompatible(destination._shape, _shape, false))
System\Numerics\Tensors\netcore\Tensor.cs (7)
238
if (!
TensorShape
.AreLengthsTheSame(destination.Lengths, lengths))
273
hasMore =
TensorShape
.AdjustToNextIndex(ranges, dimension - 1, destination.Lengths);
421
TensorShape
shape =
TensorShape
.Create(lengths, strides, pinned);
2201
TensorShape
tmpShape =
TensorShape
.Create(tensor.Lengths[1..], tensor.Strides[1..], tensor.IsPinned);
2314
if (!
TensorShape
.AreCompatible(destination._shape, tensor._shape, false))
System\Numerics\Tensors\netcore\Tensor_1.cs (15)
23
internal readonly
TensorShape
_shape;
29
_shape =
TensorShape
.Create(lengths, strides, pinned);
36
_shape =
TensorShape
.Create(array);
43
_shape =
TensorShape
.Create(array, lengths, strides);
50
_shape =
TensorShape
.Create(array, start, lengths, strides);
55
internal Tensor(T[] array, in
TensorShape
shape)
64
internal Tensor(T[] array, int start, in
TensorShape
shape)
83
get => ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_values), _start + _shape.GetLinearOffset<
TensorShape
.GetOffsetAndLengthForNInt, nint>(indexes));
89
get => ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_values), _start + _shape.GetLinearOffset<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(indexes));
211
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
226
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
241
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
System\Numerics\Tensors\netcore\TensorDimensionSpan_1.cs (2)
17
private readonly
TensorShape
_sliceShape;
30
_sliceShape =
TensorShape
.Create((dimension != tensor.Rank) ? tensor.Lengths[dimension..] : [1], tensor.Strides[dimension..], tensor.IsPinned);
System\Numerics\Tensors\netcore\TensorOperation.cs (11)
34
ref readonly
TensorShape
destinationShape = ref ((x._shape.FlattenedLength > y._shape.FlattenedLength) ? ref x._shape : ref y._shape);
226
ref readonly
TensorShape
destinationShape = ref ((x._shape.FlattenedLength > y._shape.FlattenedLength) ? ref x._shape : ref y._shape);
324
if (!
TensorShape
.AreCompatible(lengths, x._shape))
331
if (!
TensorShape
.AreCompatible(x._shape, y._shape, true))
338
if (!
TensorShape
.AreCompatible(destination._shape, x._shape, false))
345
if (
TensorShape
.AreCompatible(x._shape, y._shape, true))
347
if (
TensorShape
.AreCompatible(destination._shape, x._shape, false))
349
if (
TensorShape
.AreCompatible(destination._shape, y._shape, false))
362
if (
TensorShape
.AreCompatible(x._shape, y._shape, true))
2634
private
TensorShape
.InlineBuffer<T> _inline;
2638
if (rank >
TensorShape
.MaxInlineRank)
System\Numerics\Tensors\netcore\TensorShape.cs (29)
49
internal readonly struct TensorShape : IEquatable<
TensorShape
>
369
public static bool operator ==(in
TensorShape
left, in
TensorShape
right)
410
public static bool operator !=(in
TensorShape
left, in
TensorShape
right) => !(left == right);
412
public nint AdjustToNextIndex(in
TensorShape
destinationShape, nint linearOffset, Span<nint> indexes)
477
public nint AdjustToPreviousIndex(in
TensorShape
destinationShape, nint linearOffset, Span<nint> indexes)
565
public static bool AreCompatible(in
TensorShape
shape1, in
TensorShape
shape2, bool allowBidirectional)
576
ref readonly
TensorShape
tmpShape = ref shape1;
646
public static bool AreCompatible(in ReadOnlySpan<nint> shape1Lengths, in
TensorShape
shape2)
692
public static bool AreLengthsTheSame(in
TensorShape
shape1, in
TensorShape
shape2)
702
public static
TensorShape
Create(Array? array)
729
TensorShape
result = new TensorShape(
745
public static
TensorShape
Create(Array? array, scoped ReadOnlySpan<int> start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, out nint linearOffset)
828
TensorShape
result = new TensorShape(linearLength - computedOffset, lengths, strides, TensorFlags.None);
850
public static
TensorShape
Create(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned)
856
public static
TensorShape
Create<T>(T[]? array)
872
public static
TensorShape
Create<T>(T[]? array, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides)
886
public static
TensorShape
Create<T>(T[]? array, int start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides)
912
public static
TensorShape
Create<T>(ref T reference, nint linearLength, bool pinned)
934
public static
TensorShape
Create<T>(ref T reference, nint linearLength, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned)
953
public static unsafe
TensorShape
Create<T>(T* address, nint linearLength)
956
public static unsafe
TensorShape
Create<T>(T* address, nint linearLength, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides = default)
960
=> (obj is
TensorShape
other) && (this == other);
962
public bool Equals(
TensorShape
other) => (this == other);
1034
public
TensorShape
Slice<TGetOffsetAndLength, T>(ReadOnlySpan<T> state, out nint linearOffset)
1143
TensorShape
result = new TensorShape(
System\Numerics\Tensors\netcore\TensorSpan_1.cs (20)
32
internal readonly
TensorShape
_shape;
41
_shape =
TensorShape
.Create(array);
58
_shape =
TensorShape
.Create(array, lengths, strides);
70
_shape =
TensorShape
.Create(array, start, lengths, strides);
80
_shape =
TensorShape
.Create(ref reference, span.Length, pinned: false);
92
_shape =
TensorShape
.Create(ref reference, span.Length, lengths, strides, pinned: false);
102
_shape =
TensorShape
.Create(array);
114
_shape =
TensorShape
.Create(array, start, lengths, strides, out nint linearOffset);
124
_shape =
TensorShape
.Create(data, dataLength);
137
_shape =
TensorShape
.Create(data, dataLength, lengths, strides);
143
_shape =
TensorShape
.Create(ref data, dataLength, lengths, strides, pinned);
147
internal TensorSpan(ref T reference, scoped in
TensorShape
shape)
156
get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<
TensorShape
.GetOffsetAndLengthForNInt, nint>(indexes));
162
get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(indexes));
284
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
294
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
304
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);