445 references to Lengths
System.Numerics.Tensors (445)
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan.cs (24)
331
nint index = TensorSpanHelpers.ComputeLinearIndex(indexes, Strides,
Lengths
);
354
nint index = TensorSpanHelpers.ComputeLinearIndex(indexes, Strides,
Lengths
);
401
public int Rank =>
Lengths
.Length;
494
TensorSpanHelpers.AdjustIndexes(_span.Rank - 1, 1, _curIndexes, _span.
Lengths
);
540
if (TensorHelpers.IsBroadcastableTo(
Lengths
, destination.Lengths))
559
nint[] tempLengths = Tensor.GetSmallestBroadcastableLengths(
Lengths
, destination.Lengths);
563
nint copyLength = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Lengths
[^1] : 1;
568
TensorSpanHelpers.Memmove(ref Unsafe.Add(ref destinationSlice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, destinationSlice.Strides, destinationSlice.Lengths)), ref Unsafe.Add(ref srcSlice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, srcSlice.Strides, srcSlice.
Lengths
)), copyLength);
596
if (TensorHelpers.IsBroadcastableTo(
Lengths
, destination.Lengths))
615
nint[] tempLengths = Tensor.GetSmallestBroadcastableLengths(
Lengths
, destination.Lengths);
619
nint copyLength = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Lengths
[^1] : 1;
624
TensorSpanHelpers.Memmove(ref Unsafe.Add(ref destinationSlice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, destinationSlice.Strides, destinationSlice.Lengths)), ref Unsafe.Add(ref srcSlice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, srcSlice.Strides, srcSlice.
Lengths
)), copyLength);
660
ranges[i] = new NRange(checked((int)indexes[i].GetOffset(
Lengths
[i])),
Lengths
[i]);
688
if (ranges.Length !=
Lengths
.Length)
717
(offsets[i], lengths[i]) = ranges[i].GetOffsetAndLength(
Lengths
[i]);
771
TensorSpanHelpers.Memmove(destination.Slice(checked((int)copiedValues)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides,
Lengths
)),
Lengths
[Rank - 1]);
773
copiedValues +=
Lengths
[Rank - 1];
814
destination.Slice(checked((int)copiedValues), (int)
Lengths
[Rank - 1]).Fill(Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides,
Lengths
)));
818
TensorSpanHelpers.Memmove(destination.Slice(checked((int)copiedValues)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides,
Lengths
)),
Lengths
[Rank - 1]);
821
copiedValues +=
Lengths
[Rank - 1];
System\Numerics\Tensors\netcore\TensorExtensions.cs (413)
56
return Broadcast(source, lengthsSource.
Lengths
);
68
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(source.
Lengths
, lengths);
71
Tensor<T> output = Tensor.CreateUninitialized<T>(intermediate.
Lengths
);
115
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(source.
Lengths
, destination.Lengths);
177
if (input.
Lengths
.SequenceEqual(shape))
180
if (!TensorHelpers.IsBroadcastableTo(input.
Lengths
, shape))
188
nint[] intermediateShape = TensorHelpers.GetIntermediateShape(input.
Lengths
, shape.Length);
445
result = Tensor.Create<bool>(x.
Lengths
, false);
449
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
472
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
479
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
523
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
539
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
560
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
583
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
606
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
645
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
667
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
676
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
682
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
690
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
729
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
748
if (filter.
Lengths
.Length != tensor.Lengths.Length)
774
if (filter.
Lengths
.Length != tensor.Lengths.Length)
813
result = Tensor.Create<bool>(x.
Lengths
, false);
817
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
843
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
850
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
896
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
914
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
935
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
956
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
974
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
995
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1022
result = Tensor.Create<bool>(x.
Lengths
, false);
1026
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1052
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1059
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1105
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
1123
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1144
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1165
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
1183
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
1204
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1226
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1235
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
1241
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
1249
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1288
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1327
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1349
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1358
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
1364
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
1372
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1411
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1450
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1473
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1496
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1535
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1574
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1597
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1620
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1659
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1698
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1725
result = Tensor.Create<bool>(x.
Lengths
, false);
1729
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1755
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1762
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1808
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
1826
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1847
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1868
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
1886
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
1907
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1934
result = Tensor.Create<bool>(x.
Lengths
, false);
1938
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1964
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1971
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2017
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
2035
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
2056
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2077
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
2095
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
2116
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2139
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2148
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2154
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2162
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2201
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2240
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2263
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2272
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2278
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2286
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2325
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2364
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2386
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2395
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2401
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2409
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2448
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2487
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2509
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2518
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2524
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2532
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2571
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2610
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2857
if (tensor.
Lengths
.SequenceEqual(lengths))
2896
if (lengthOffset < tensor.Rank && arrLengths[i] == tensor.
Lengths
[lengthOffset])
2903
origStrides.Insert(i, tensor.Strides[i] * tensor.
Lengths
[i]);
2996
Tensor<T> output = Tensor.Create<T>(tensor.
Lengths
);
3010
Tensor<T> output = Tensor.Create<T>(tensor.
Lengths
);
3049
for (nint i = dimension; i < tensor.
Lengths
.Length; i++)
3051
copyLength *= tensor.
Lengths
[(int)i];
3053
copyLength /= tensor.
Lengths
[(int)dimension];
3077
iIndices[(int)dimension] = tensor.
Lengths
[(int)dimension] - 1;
3079
ReadOnlyTensorSpan<T> islice = tensor.Slice(tensor.
Lengths
);
3083
TensorSpanHelpers.Memmove(ref Unsafe.Add(ref destination._reference, TensorSpanHelpers.ComputeLinearIndex(oIndices, tensor.Strides, tensor.
Lengths
)), ref Unsafe.Add(ref islice._reference, TensorSpanHelpers.ComputeLinearIndex(iIndices, islice.Strides, islice.
Lengths
)), copyLength);
3084
TensorSpanHelpers.AdjustIndexes((int)dimension, 1, oIndices, tensor.
Lengths
);
3085
TensorSpanHelpers.AdjustIndexesDown((int)dimension, 1, iIndices, tensor.
Lengths
);
3109
&& tensor.Lengths.SequenceEqual(other.
Lengths
)
3121
&& tensor.
Lengths
.SequenceEqual(other.
Lengths
)
3151
if (!TensorHelpers.IsBroadcastableTo(values.
Lengths
, tensor.Lengths))
3161
if (!TensorHelpers.IsBroadcastableTo(values.
Lengths
, srcSpan.Lengths))
3180
if (tensor.
Lengths
[(int)dimension] % splitCount != 0)
3187
for (nint i = dimension; i < tensor.
Lengths
.Length; i++)
3189
copyLength *= tensor.
Lengths
[(int)i];
3192
nint[] newShape = tensor.
Lengths
.ToArray();
3225
ReadOnlyTensorSpan<T> islice = tensor.Slice(tensor.
Lengths
);
3231
TensorSpanHelpers.Memmove(ref Unsafe.Add(ref oslice._reference, TensorSpanHelpers.ComputeLinearIndex(oIndices, outputs[0].Strides, outputs[0].Lengths)), ref Unsafe.Add(ref islice._reference, TensorSpanHelpers.ComputeLinearIndex(iIndices, islice.Strides, islice.
Lengths
)), copyLength);
3233
TensorSpanHelpers.AdjustIndexes((int)dimension - 1, 1, iIndices, tensor.
Lengths
);
3387
for (int i = 0; i < tensor.
Lengths
.Length; i++)
3389
if (tensor.
Lengths
[i] != 1)
3391
tempLengths.Add(tensor.
Lengths
[i]);
3399
if (tensor.
Lengths
[dimension] != 1)
3403
for (int i = 0; i < tensor.
Lengths
.Length; i++)
3407
tempLengths.Add(tensor.
Lengths
[i]);
3538
T[] values = new T[tensor.
Lengths
[tensor.Rank - 1]];
3541
var sp = new ReadOnlyTensorSpan<T>(ref Unsafe.Add(ref tensor._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, tensor.Strides, tensor.
Lengths
)), [tensor.
Lengths
[tensor.Rank - 1]], [1], tensor.
Lengths
[tensor.Rank - 1]);
3547
TensorSpanHelpers.AdjustIndexes(tensor.Rank - 2, 1, curIndexes, tensor.
Lengths
);
3548
copiedValues += tensor.
Lengths
[tensor.Rank - 1];
3617
if (!TensorHelpers.IsBroadcastableTo(tensor.
Lengths
, destination.Lengths))
3620
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(tensor.
Lengths
, destination.Lengths);
3711
if (dimension > tensor.
Lengths
.Length)
3716
Span<nint> lengths = tensor.
Lengths
.Length + 1 <= TensorShape.MaxInlineRank ?
3717
stackalloc nint[tensor.
Lengths
.Length + 1] :
3718
new nint[tensor.
Lengths
.Length + 1];
3719
tensor.
Lengths
.Slice(0, dimension).CopyTo(lengths);
3720
tensor.
Lengths
.Slice(dimension).CopyTo(lengths.Slice(dimension + 1));
3735
strides[dimension] = tensor.Strides[dimension] * tensor.
Lengths
[dimension];
3751
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3776
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3801
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3826
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3853
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
3855
output = Tensor.Create<T>(x.
Lengths
);
3859
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
3874
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3912
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3937
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3962
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3987
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4014
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4016
output = Tensor.Create<T>(x.
Lengths
);
4020
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4047
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4073
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4102
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4104
output = Tensor.Create<T>(x.
Lengths
);
4108
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4135
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4161
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4189
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4214
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4254
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4256
output = Tensor.Create<T>(x.
Lengths
);
4260
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4287
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4316
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4318
output = Tensor.Create<T>(x.
Lengths
);
4322
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4349
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4376
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4401
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4428
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4458
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4488
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4517
Tensor<T> output = Create<T>(x.
Lengths
);
4532
if (x.
Lengths
.SequenceEqual(sign.
Lengths
))
4534
output = Tensor.Create<T>(x.
Lengths
);
4538
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, sign.
Lengths
));
4578
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4603
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4635
if (x.
Lengths
[1] != y.
Lengths
[1])
4636
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4638
nint dim1 = x.
Lengths
[0];
4639
nint dim2 = y.
Lengths
[0];
4665
if (x.
Lengths
[1] != y.
Lengths
[1])
4666
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4668
nint dim1 = x.
Lengths
[0];
4669
nint dim2 = y.
Lengths
[0];
4672
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4683
int rowLength = (int)x.
Lengths
[1];
4688
lspan = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref x._reference, TensorSpanHelpers.ComputeLinearIndex(leftIndexes, x.Strides, x.
Lengths
)), (int)rowLength);
4689
rspan = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref y._reference, TensorSpanHelpers.ComputeLinearIndex(rightIndexes, y.Strides, y.
Lengths
)), (int)rowLength);
4720
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4755
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4794
Tensor<T> output = Create<T>(x.
Lengths
);
4807
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4822
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4824
output = Tensor.Create<T>(x.
Lengths
);
4828
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4894
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4919
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4942
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4963
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4984
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5005
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5026
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5052
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5054
output = Tensor.Create<T>(x.
Lengths
);
5058
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5088
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5090
output = Tensor.Create<T>(x.
Lengths
);
5094
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5118
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5140
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
5163
Tensor<int> output = Tensor.Create<int>(x.
Lengths
, x.Strides);
5232
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5257
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5280
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5282
output = Tensor.Create<T>(x.
Lengths
);
5286
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5309
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5334
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5359
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5384
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5409
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5434
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5467
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5469
output = Tensor.Create<T>(x.
Lengths
);
5473
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5496
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5528
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5530
output = Tensor.Create<T>(x.
Lengths
);
5534
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5557
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5589
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5591
output = Tensor.Create<T>(x.
Lengths
);
5595
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5618
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5650
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5652
output = Tensor.Create<T>(x.
Lengths
);
5656
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5679
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5711
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5713
output = Tensor.Create<T>(x.
Lengths
);
5717
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5740
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5772
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5774
output = Tensor.Create<T>(x.
Lengths
);
5778
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5801
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5833
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5835
output = Tensor.Create<T>(x.
Lengths
);
5839
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5862
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5894
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5896
output = Tensor.Create<T>(x.
Lengths
);
5900
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5923
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5948
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5963
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5965
output = Tensor.Create<T>(x.
Lengths
);
5969
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6011
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6044
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6065
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6088
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6090
output = Tensor.Create<T>(x.
Lengths
);
6094
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6117
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6139
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
6172
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6193
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6215
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6245
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6276
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6305
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6326
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6354
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6381
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6409
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6432
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6455
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6476
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6497
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6520
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6559
Tensor<T> output = Create<T>(x.
Lengths
);
6572
Tensor<T> output = Create<T>(y.
Lengths
);
6586
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6588
output = Tensor.Create<T>(x.
Lengths
);
6592
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6668
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6689
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6710
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6731
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6752
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6775
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6777
output = Tensor.Create<T>(x.
Lengths
);
6781
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6806
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6900
nint[] newLengths = Tensor.GetSmallestBroadcastableLengths(left.
Lengths
, right.
Lengths
);
6936
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
6938
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
6944
curIndex = stackalloc nint[input.
Lengths
.Length];
6949
nint rowLength = input.
Lengths
[^1];
6957
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
6988
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
6990
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
6996
curIndex = stackalloc nint[input.
Lengths
.Length];
7001
nint rowLength = input.
Lengths
[^1];
7009
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
7040
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
7042
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
7048
curIndex = stackalloc nint[input.
Lengths
.Length];
7053
nint rowLength = input.
Lengths
[^1];
7061
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
7073
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(left.
Lengths
, right.
Lengths
);
7129
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7139
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.
Lengths
)), (int)rowLength);
7142
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7152
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.
Lengths
)), (int)rowLength);
7155
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7165
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.
Lengths
)), (int)rowLength);
7166
rspan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.
Lengths
)), (int)rowLength);
7169
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
System\Numerics\Tensors\netcore\TensorHelpers.cs (4)
96
=> tensor1.
Lengths
.SequenceEqual(tensor2.
Lengths
);
110
if (tensor._shape.Strides[i] != TensorPrimitives.Product(tensor.
Lengths
.Slice(i + 1, tensor.
Lengths
.Length - i - 1)))
System\Numerics\Tensors\netcore\TensorSpan.cs (4)
592
nint copyLength = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Lengths
[^1] : 1;
597
TensorSpanHelpers.Memmove(ref Unsafe.Add(ref destinationSlice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, destinationSlice.Strides, destinationSlice.Lengths)), ref Unsafe.Add(ref srcSlice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, srcSlice.Strides, srcSlice.
Lengths
)), copyLength);
646
nint copyLength = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Lengths
[^1] : 1;
651
TensorSpanHelpers.Memmove(ref Unsafe.Add(ref destinationSlice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, destinationSlice.Strides, destinationSlice.Lengths)), ref Unsafe.Add(ref srcSlice._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, srcSlice.Strides, srcSlice.
Lengths
)), copyLength);