441 references to Lengths
System.Numerics.Tensors (441)
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan.cs (24)
314
nint index = TensorSpanHelpers.ComputeLinearIndex(indexes, Strides,
Lengths
);
337
nint index = TensorSpanHelpers.ComputeLinearIndex(indexes, Strides,
Lengths
);
384
public int Rank =>
Lengths
.Length;
477
TensorSpanHelpers.AdjustIndexes(_span.Rank - 1, 1, _curIndexes, _span.
Lengths
);
523
if (TensorHelpers.IsBroadcastableTo(
Lengths
, destination.Lengths))
542
nint[] tempLengths = Tensor.GetSmallestBroadcastableLengths(
Lengths
, destination.Lengths);
546
nint copyLength = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Lengths
[^1] : 1;
551
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);
579
if (TensorHelpers.IsBroadcastableTo(
Lengths
, destination.Lengths))
598
nint[] tempLengths = Tensor.GetSmallestBroadcastableLengths(
Lengths
, destination.Lengths);
602
nint copyLength = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Lengths
[^1] : 1;
607
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);
643
ranges[i] = new NRange(checked((int)indexes[i].GetOffset(
Lengths
[i])),
Lengths
[i]);
671
if (ranges.Length !=
Lengths
.Length)
700
(offsets[i], lengths[i]) = ranges[i].GetOffsetAndLength(
Lengths
[i]);
754
TensorSpanHelpers.Memmove(destination.Slice(checked((int)copiedValues)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides,
Lengths
)),
Lengths
[Rank - 1]);
756
copiedValues +=
Lengths
[Rank - 1];
797
destination.Slice(checked((int)copiedValues), (int)
Lengths
[Rank - 1]).Fill(Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides,
Lengths
)));
801
TensorSpanHelpers.Memmove(destination.Slice(checked((int)copiedValues)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides,
Lengths
)),
Lengths
[Rank - 1]);
804
copiedValues +=
Lengths
[Rank - 1];
System\Numerics\Tensors\netcore\TensorExtensions.cs (409)
71
return Broadcast(source, lengthsSource.
Lengths
);
83
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(source.
Lengths
, lengths);
86
Tensor<T> output = Tensor.CreateUninitialized<T>(intermediate.
Lengths
);
130
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(source.
Lengths
, destination.Lengths);
192
if (input.
Lengths
.SequenceEqual(shape))
195
if (!TensorHelpers.IsBroadcastableTo(input.
Lengths
, shape))
203
nint[] intermediateShape = TensorHelpers.GetIntermediateShape(input.
Lengths
, shape.Length);
460
result = Tensor.Create<bool>(x.
Lengths
, false);
464
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
487
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
494
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
538
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
554
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
575
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
598
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
621
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
660
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
682
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
691
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
697
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
705
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
744
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
763
if (filter.
Lengths
.Length != tensor.Lengths.Length)
789
if (filter.
Lengths
.Length != tensor.Lengths.Length)
828
result = Tensor.Create<bool>(x.
Lengths
, false);
832
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
858
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
865
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
911
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
929
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
950
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
971
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
989
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
1010
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1037
result = Tensor.Create<bool>(x.
Lengths
, false);
1041
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1067
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1074
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1120
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
1138
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1159
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1180
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
1198
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
1219
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1241
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1250
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
1256
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
1264
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1303
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1342
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1364
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1373
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
1379
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
1387
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1426
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1465
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1488
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1511
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1550
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1589
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1612
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1635
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1674
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1713
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1740
result = Tensor.Create<bool>(x.
Lengths
, false);
1744
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1770
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1777
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1823
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
1841
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1862
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1883
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
1901
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
1922
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1949
result = Tensor.Create<bool>(x.
Lengths
, false);
1953
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1979
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1986
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2032
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
2050
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
2071
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2092
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
2110
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
2131
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2154
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2163
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2169
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2177
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2216
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2255
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2278
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2287
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2293
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2301
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2340
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2379
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2401
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2410
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2416
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2424
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2463
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2502
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2524
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2533
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2539
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2547
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2586
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2625
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2866
if (tensor.
Lengths
.SequenceEqual(lengths))
2905
if (lengthOffset < tensor.Rank && arrLengths[i] == tensor.
Lengths
[lengthOffset])
2912
origStrides.Insert(i, tensor.Strides[i] * tensor.
Lengths
[i]);
3005
Tensor<T> output = Tensor.Create<T>(tensor.
Lengths
);
3019
Tensor<T> output = Tensor.Create<T>(tensor.
Lengths
);
3058
for (nint i = dimension; i < tensor.
Lengths
.Length; i++)
3060
copyLength *= tensor.
Lengths
[(int)i];
3062
copyLength /= tensor.
Lengths
[(int)dimension];
3086
iIndices[(int)dimension] = tensor.
Lengths
[(int)dimension] - 1;
3088
ReadOnlyTensorSpan<T> islice = tensor.Slice(tensor.
Lengths
);
3092
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);
3093
TensorSpanHelpers.AdjustIndexes((int)dimension, 1, oIndices, tensor.
Lengths
);
3094
TensorSpanHelpers.AdjustIndexesDown((int)dimension, 1, iIndices, tensor.
Lengths
);
3118
&& tensor.Lengths.SequenceEqual(other.
Lengths
)
3130
&& tensor.
Lengths
.SequenceEqual(other.
Lengths
)
3160
if (!TensorHelpers.IsBroadcastableTo(values.
Lengths
, tensor.Lengths))
3170
if (!TensorHelpers.IsBroadcastableTo(values.
Lengths
, srcSpan.Lengths))
3189
if (tensor.
Lengths
[(int)dimension] % splitCount != 0)
3196
for (nint i = dimension; i < tensor.
Lengths
.Length; i++)
3198
copyLength *= tensor.
Lengths
[(int)i];
3201
nint[] newShape = tensor.
Lengths
.ToArray();
3234
ReadOnlyTensorSpan<T> islice = tensor.Slice(tensor.
Lengths
);
3240
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);
3242
TensorSpanHelpers.AdjustIndexes((int)dimension - 1, 1, iIndices, tensor.
Lengths
);
3396
for (int i = 0; i < tensor.
Lengths
.Length; i++)
3398
if (tensor.
Lengths
[i] != 1)
3400
tempLengths.Add(tensor.
Lengths
[i]);
3408
if (tensor.
Lengths
[dimension] != 1)
3412
for (int i = 0; i < tensor.
Lengths
.Length; i++)
3416
tempLengths.Add(tensor.
Lengths
[i]);
3561
T[] values = new T[tensor.
Lengths
[tensor.Rank - 1]];
3564
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]);
3570
TensorSpanHelpers.AdjustIndexes(tensor.Rank - 2, 1, curIndexes, tensor.
Lengths
);
3571
copiedValues += tensor.
Lengths
[tensor.Rank - 1];
3638
if (!TensorHelpers.IsBroadcastableTo(tensor.
Lengths
, destination.Lengths))
3641
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(tensor.
Lengths
, destination.Lengths);
3706
if (dimension > tensor.
Lengths
.Length)
3711
List<nint> tempLengths = tensor.
Lengths
.ToArray().ToList();
3718
tempStrides.Insert(dimension, tensor.Strides[dimension] * tensor.
Lengths
[dimension]);
3733
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3758
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3783
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3808
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3835
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
3837
output = Tensor.Create<T>(x.
Lengths
);
3841
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
3856
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3894
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3919
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3944
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3969
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3996
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
3998
output = Tensor.Create<T>(x.
Lengths
);
4002
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4029
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4055
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4084
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4086
output = Tensor.Create<T>(x.
Lengths
);
4090
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4117
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4143
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4171
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4196
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4223
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4225
output = Tensor.Create<T>(x.
Lengths
);
4229
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4256
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4285
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4287
output = Tensor.Create<T>(x.
Lengths
);
4291
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4318
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4345
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4370
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4397
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4427
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4457
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4486
Tensor<T> output = Create<T>(x.
Lengths
);
4501
if (x.
Lengths
.SequenceEqual(sign.
Lengths
))
4503
output = Tensor.Create<T>(x.
Lengths
);
4507
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, sign.
Lengths
));
4547
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4572
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4604
if (x.
Lengths
[1] != y.
Lengths
[1])
4605
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4607
nint dim1 = x.
Lengths
[0];
4608
nint dim2 = y.
Lengths
[0];
4634
if (x.
Lengths
[1] != y.
Lengths
[1])
4635
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4637
nint dim1 = x.
Lengths
[0];
4638
nint dim2 = y.
Lengths
[0];
4641
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4652
int rowLength = (int)x.
Lengths
[1];
4657
lspan = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref x._reference, TensorSpanHelpers.ComputeLinearIndex(leftIndexes, x.Strides, x.
Lengths
)), (int)rowLength);
4658
rspan = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref y._reference, TensorSpanHelpers.ComputeLinearIndex(rightIndexes, y.Strides, y.
Lengths
)), (int)rowLength);
4689
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4724
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4763
Tensor<T> output = Create<T>(x.
Lengths
);
4776
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4791
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4793
output = Tensor.Create<T>(x.
Lengths
);
4797
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4863
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4888
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4911
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4932
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4953
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4974
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4995
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5021
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5023
output = Tensor.Create<T>(x.
Lengths
);
5027
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5057
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5059
output = Tensor.Create<T>(x.
Lengths
);
5063
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5087
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5109
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
5132
Tensor<int> output = Tensor.Create<int>(x.
Lengths
, x.Strides);
5201
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5226
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5249
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5251
output = Tensor.Create<T>(x.
Lengths
);
5255
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5278
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5303
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5328
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5353
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5378
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5403
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5436
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5438
output = Tensor.Create<T>(x.
Lengths
);
5442
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5465
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5497
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5499
output = Tensor.Create<T>(x.
Lengths
);
5503
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5526
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5558
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5560
output = Tensor.Create<T>(x.
Lengths
);
5564
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5587
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5619
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5621
output = Tensor.Create<T>(x.
Lengths
);
5625
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5648
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5680
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5682
output = Tensor.Create<T>(x.
Lengths
);
5686
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5709
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5741
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5743
output = Tensor.Create<T>(x.
Lengths
);
5747
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5770
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5802
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5804
output = Tensor.Create<T>(x.
Lengths
);
5808
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5831
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5863
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5865
output = Tensor.Create<T>(x.
Lengths
);
5869
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5892
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5917
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5932
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5934
output = Tensor.Create<T>(x.
Lengths
);
5938
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5980
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6013
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6034
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6057
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6059
output = Tensor.Create<T>(x.
Lengths
);
6063
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6086
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6108
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
6141
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6162
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6184
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6214
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6245
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6274
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6295
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6323
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6350
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6378
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6401
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6424
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6445
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6466
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6489
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6515
Tensor<T> output = Create<T>(x.
Lengths
);
6528
Tensor<T> output = Create<T>(y.
Lengths
);
6542
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6544
output = Tensor.Create<T>(x.
Lengths
);
6548
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6611
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6632
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6653
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6674
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6695
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6718
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6720
output = Tensor.Create<T>(x.
Lengths
);
6724
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6749
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6843
nint[] newLengths = Tensor.GetSmallestBroadcastableLengths(left.
Lengths
, right.
Lengths
);
6879
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
6881
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
6887
curIndex = stackalloc nint[input.
Lengths
.Length];
6892
nint rowLength = input.
Lengths
[^1];
6900
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
6931
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
6933
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
6939
curIndex = stackalloc nint[input.
Lengths
.Length];
6944
nint rowLength = input.
Lengths
[^1];
6952
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
6983
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
6985
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
6991
curIndex = stackalloc nint[input.
Lengths
.Length];
6996
nint rowLength = input.
Lengths
[^1];
7004
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
7016
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(left.
Lengths
, right.
Lengths
);
7072
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7082
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.
Lengths
)), (int)rowLength);
7085
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7095
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.
Lengths
)), (int)rowLength);
7098
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7108
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.
Lengths
)), (int)rowLength);
7109
rspan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.
Lengths
)), (int)rowLength);
7112
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
System\Numerics\Tensors\netcore\TensorHelpers.cs (4)
98
=> tensor1.
Lengths
.SequenceEqual(tensor2.
Lengths
);
112
if (tensor._shape.Strides[i] != TensorPrimitives.Product(tensor.
Lengths
.Slice(i + 1, tensor.
Lengths
.Length - i - 1)))
System\Numerics\Tensors\netcore\TensorSpan.cs (4)
577
nint copyLength = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Lengths
[^1] : 1;
582
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);
631
nint copyLength = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Lengths
[^1] : 1;
636
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);