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)
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\ReadOnlyTensorSpan_1.cs (23)
29
internal readonly
TensorShape
_shape;
40
_shape =
TensorShape
.Create(array);
75
_shape =
TensorShape
.Create(array, lengths, strides);
99
_shape =
TensorShape
.Create(array, start, lengths, strides);
111
_shape =
TensorShape
.Create(ref reference, span.Length, pinned: false);
141
_shape =
TensorShape
.Create(ref reference, span.Length, lengths, strides, pinned: false);
153
_shape =
TensorShape
.Create(array);
180
_shape =
TensorShape
.Create(array, start, lengths, strides, out nint linearOffset);
195
_shape =
TensorShape
.Create(data, dataLength);
234
_shape =
TensorShape
.Create(data, dataLength, lengths, strides);
240
_shape =
TensorShape
.Create(in data, dataLength, lengths, strides, pinned);
244
internal ReadOnlyTensorSpan(ref readonly T reference, scoped in
TensorShape
shape)
253
get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<
TensorShape
.GetOffsetAndLengthForNInt, nint>(indexes));
259
get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(indexes));
405
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
415
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
425
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
450
if (
TensorShape
.AreCompatible(destination._shape, _shape, false))
473
nint longestContiguousLength = _shape.GetLongestContiguousLength<
TensorShape
.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
489
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);
2124
TensorShape
tmpShape =
TensorShape
.Create(tensor.Lengths[1..], tensor.Strides[1..], tensor.IsPinned);
2275
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))
2732
private
TensorShape
.InlineBuffer<T> _inline;
2736
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)
29
internal readonly
TensorShape
_shape;
38
_shape =
TensorShape
.Create(array);
55
_shape =
TensorShape
.Create(array, lengths, strides);
67
_shape =
TensorShape
.Create(array, start, lengths, strides);
77
_shape =
TensorShape
.Create(ref reference, span.Length, pinned: false);
89
_shape =
TensorShape
.Create(ref reference, span.Length, lengths, strides, pinned: false);
99
_shape =
TensorShape
.Create(array);
111
_shape =
TensorShape
.Create(array, start, lengths, strides, out nint linearOffset);
121
_shape =
TensorShape
.Create(data, dataLength);
134
_shape =
TensorShape
.Create(data, dataLength, lengths, strides);
140
_shape =
TensorShape
.Create(ref data, dataLength, lengths, strides, pinned);
144
internal TensorSpan(ref T reference, scoped in
TensorShape
shape)
153
get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<
TensorShape
.GetOffsetAndLengthForNInt, nint>(indexes));
159
get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(indexes));
301
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
311
TensorShape
shape = _shape.Slice<
TensorShape
.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
321
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);