9 instantiations of TensorShape
System.Numerics.Tensors (9)
System\Numerics\Tensors\netcore\TensorShape.cs (9)
724
TensorShape result = new
TensorShape
(
823
TensorShape result = new
TensorShape
(linearLength - computedOffset, lengths, strides, TensorFlags.None);
848
return new
TensorShape
(linearLength: -1, lengths: lengths, strides: strides, flags: flags);
856
return new
TensorShape
(
871
return new
TensorShape
(array.Length, lengths, strides, TensorFlags.None);
893
return new
TensorShape
(linearLength, lengths, strides, TensorFlags.None);
914
return new
TensorShape
(
934
return new
TensorShape
(linearLength, lengths, strides, flags);
1198
TensorShape result = new
TensorShape
(
111 references to TensorShape
System.Numerics.Tensors (111)
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 (23)
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(in data, dataLength, lengths, strides, pinned);
247
internal ReadOnlyTensorSpan(ref readonly 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));
408
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
418
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
428
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
442
if (
TensorShape
.AreCompatible(destination._shape, _shape, false))
465
nint longestContiguousLength = _shape.GetLongestContiguousLength<
TensorShape
.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
481
nint longestContiguousLength = _shape.GetLongestContiguousLength<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
System\Numerics\Tensors\netcore\Tensor.cs (7)
237
if (!
TensorShape
.AreLengthsTheSame(destination.Lengths, lengths))
272
hasMore =
TensorShape
.AdjustToNextIndex(ranges, dimension - 1, destination.Lengths);
333
TensorShape
shape =
TensorShape
.Create(lengths, strides, pinned);
2113
TensorShape
tmpShape =
TensorShape
.Create(tensor.Lengths[1..], tensor.Strides[1..], tensor.IsPinned);
2226
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));
217
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
232
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
247
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)
44
internal readonly struct TensorShape : IEquatable<
TensorShape
>
364
public static bool operator ==(in
TensorShape
left, in
TensorShape
right)
405
public static bool operator !=(in
TensorShape
left, in
TensorShape
right) => !(left == right);
407
public nint AdjustToNextIndex(in
TensorShape
destinationShape, nint linearOffset, Span<nint> indexes)
472
public nint AdjustToPreviousIndex(in
TensorShape
destinationShape, nint linearOffset, Span<nint> indexes)
560
public static bool AreCompatible(in
TensorShape
shape1, in
TensorShape
shape2, bool allowBidirectional)
571
ref readonly
TensorShape
tmpShape = ref shape1;
641
public static bool AreCompatible(in ReadOnlySpan<nint> shape1Lengths, in
TensorShape
shape2)
687
public static bool AreLengthsTheSame(in
TensorShape
shape1, in
TensorShape
shape2)
697
public static
TensorShape
Create(Array? array)
724
TensorShape
result = new TensorShape(
740
public static
TensorShape
Create(Array? array, scoped ReadOnlySpan<int> start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, out nint linearOffset)
823
TensorShape
result = new TensorShape(linearLength - computedOffset, lengths, strides, TensorFlags.None);
845
public static
TensorShape
Create(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned)
851
public static
TensorShape
Create<T>(T[]? array)
867
public static
TensorShape
Create<T>(T[]? array, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides)
881
public static
TensorShape
Create<T>(T[]? array, int start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides)
907
public static
TensorShape
Create<T>(ref readonly T reference, nint linearLength, bool pinned)
929
public static
TensorShape
Create<T>(ref readonly T reference, nint linearLength, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned)
948
public static unsafe
TensorShape
Create<T>(T* address, nint linearLength)
951
public static unsafe
TensorShape
Create<T>(T* address, nint linearLength, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides = default)
955
=> (obj is
TensorShape
other) && (this == other);
957
public bool Equals(
TensorShape
other) => (this == other);
1089
public
TensorShape
Slice<TGetOffsetAndLength, T>(ReadOnlySpan<T> state, out nint linearOffset)
1198
TensorShape
result = new TensorShape(
System\Numerics\Tensors\netcore\TensorSpan_1.cs (22)
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));
304
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
314
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
324
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
344
nint longestContiguousLength = _shape.GetLongestContiguousLength<
TensorShape
.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
360
nint longestContiguousLength = _shape.GetLongestContiguousLength<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);