446 references to Lengths
System.Numerics.Tensors (446)
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 (414)
70
return Broadcast(source, lengthsSource.
Lengths
);
82
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(source.
Lengths
, lengths);
85
Tensor<T> output = Tensor.CreateUninitialized<T>(intermediate.
Lengths
);
129
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(source.
Lengths
, destination.Lengths);
191
if (input.
Lengths
.SequenceEqual(shape))
194
if (!TensorHelpers.IsBroadcastableTo(input.
Lengths
, shape))
202
nint[] intermediateShape = TensorHelpers.GetIntermediateShape(input.
Lengths
, shape.Length);
459
result = Tensor.Create<bool>(x.
Lengths
, false);
463
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
486
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
493
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
537
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
553
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
574
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
597
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
620
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
659
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
681
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
690
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
696
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
704
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
743
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
762
if (filter.
Lengths
.Length != tensor.Lengths.Length)
788
if (filter.
Lengths
.Length != tensor.Lengths.Length)
827
result = Tensor.Create<bool>(x.
Lengths
, false);
831
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
857
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
864
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
910
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
928
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
949
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
970
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
988
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
1009
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1036
result = Tensor.Create<bool>(x.
Lengths
, false);
1040
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1066
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1073
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1119
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
1137
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1158
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1179
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
1197
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
1218
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1240
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1249
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
1255
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
1263
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1302
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1341
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1363
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1372
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
1378
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
1386
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1425
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1464
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1487
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1510
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1549
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1588
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1611
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1634
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
1673
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1712
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1739
result = Tensor.Create<bool>(x.
Lengths
, false);
1743
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1769
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1776
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1822
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
1840
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1861
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
1882
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
1900
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
1921
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
1948
result = Tensor.Create<bool>(x.
Lengths
, false);
1952
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
1978
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
1985
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2031
Tensor<bool> result = Tensor.Create<bool>(x.
Lengths
, false);
2049
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, x.
Lengths
))
2070
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2091
Tensor<bool> result = Tensor.Create<bool>(y.
Lengths
, false);
2109
if (!TensorHelpers.AreLengthsTheSame(destination.Lengths, y.
Lengths
))
2130
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2153
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2162
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2168
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2176
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2215
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2254
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2277
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2286
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2292
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2300
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2339
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2378
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2400
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2409
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2415
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2423
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2462
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2501
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2523
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
);
2532
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Lengths
.Length);
2538
curIndex = stackalloc nint[broadcastedRight.
Lengths
.Length];
2546
TensorSpanHelpers.AdjustIndexes(broadcastedRight.Rank - 1, 1, curIndex, broadcastedRight.
Lengths
);
2585
TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.
Lengths
);
2624
TensorSpanHelpers.AdjustIndexes(y.Rank - 1, 1, curIndex, y.
Lengths
);
2871
if (tensor.
Lengths
.SequenceEqual(lengths))
2910
if (lengthOffset < tensor.Rank && arrLengths[i] == tensor.
Lengths
[lengthOffset])
2917
origStrides.Insert(i, tensor.Strides[i] * tensor.
Lengths
[i]);
3010
Tensor<T> output = Tensor.Create<T>(tensor.
Lengths
);
3024
Tensor<T> output = Tensor.Create<T>(tensor.
Lengths
);
3063
for (nint i = dimension; i < tensor.
Lengths
.Length; i++)
3065
copyLength *= tensor.
Lengths
[(int)i];
3067
copyLength /= tensor.
Lengths
[(int)dimension];
3091
iIndices[(int)dimension] = tensor.
Lengths
[(int)dimension] - 1;
3093
ReadOnlyTensorSpan<T> islice = tensor.Slice(tensor.
Lengths
);
3097
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);
3098
TensorSpanHelpers.AdjustIndexes((int)dimension, 1, oIndices, tensor.
Lengths
);
3099
TensorSpanHelpers.AdjustIndexesDown((int)dimension, 1, iIndices, tensor.
Lengths
);
3123
&& tensor.Lengths.SequenceEqual(other.
Lengths
)
3135
&& tensor.
Lengths
.SequenceEqual(other.
Lengths
)
3165
if (!TensorHelpers.IsBroadcastableTo(values.
Lengths
, tensor.Lengths))
3175
if (!TensorHelpers.IsBroadcastableTo(values.
Lengths
, srcSpan.Lengths))
3194
if (tensor.
Lengths
[(int)dimension] % splitCount != 0)
3201
for (nint i = dimension; i < tensor.
Lengths
.Length; i++)
3203
copyLength *= tensor.
Lengths
[(int)i];
3206
nint[] newShape = tensor.
Lengths
.ToArray();
3239
ReadOnlyTensorSpan<T> islice = tensor.Slice(tensor.
Lengths
);
3245
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);
3247
TensorSpanHelpers.AdjustIndexes((int)dimension - 1, 1, iIndices, tensor.
Lengths
);
3401
for (int i = 0; i < tensor.
Lengths
.Length; i++)
3403
if (tensor.
Lengths
[i] != 1)
3405
tempLengths.Add(tensor.
Lengths
[i]);
3413
if (tensor.
Lengths
[dimension] != 1)
3417
for (int i = 0; i < tensor.
Lengths
.Length; i++)
3421
tempLengths.Add(tensor.
Lengths
[i]);
3518
Tensor<T> temp = CreateUninitialized<T>(x.
Lengths
);
3571
T[] values = new T[tensor.
Lengths
[tensor.Rank - 1]];
3574
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]);
3580
TensorSpanHelpers.AdjustIndexes(tensor.Rank - 2, 1, curIndexes, tensor.
Lengths
);
3581
copiedValues += tensor.
Lengths
[tensor.Rank - 1];
3650
if (!TensorHelpers.IsBroadcastableTo(tensor.
Lengths
, destination.Lengths))
3653
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(tensor.
Lengths
, destination.Lengths);
3744
if (dimension > tensor.
Lengths
.Length)
3749
Span<nint> lengths = tensor.
Lengths
.Length + 1 <= TensorShape.MaxInlineRank ?
3750
stackalloc nint[tensor.
Lengths
.Length + 1] :
3751
new nint[tensor.
Lengths
.Length + 1];
3752
tensor.
Lengths
.Slice(0, dimension).CopyTo(lengths);
3753
tensor.
Lengths
.Slice(dimension).CopyTo(lengths.Slice(dimension + 1));
3768
strides[dimension] = tensor.Strides[dimension] * tensor.
Lengths
[dimension];
3784
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3809
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3834
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3859
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3886
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
3888
output = Tensor.Create<T>(x.
Lengths
);
3892
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
3907
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3945
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3970
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3995
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4020
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4047
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4049
output = Tensor.Create<T>(x.
Lengths
);
4053
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4080
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4106
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4135
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4137
output = Tensor.Create<T>(x.
Lengths
);
4141
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4168
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4194
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4222
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4247
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4274
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4276
output = Tensor.Create<T>(x.
Lengths
);
4280
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4307
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4336
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4338
output = Tensor.Create<T>(x.
Lengths
);
4342
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4369
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4396
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4421
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4448
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4478
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4508
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4537
Tensor<T> output = Create<T>(x.
Lengths
);
4552
if (x.
Lengths
.SequenceEqual(sign.
Lengths
))
4554
output = Tensor.Create<T>(x.
Lengths
);
4558
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, sign.
Lengths
));
4598
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4623
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4655
if (x.
Lengths
[1] != y.
Lengths
[1])
4656
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4658
nint dim1 = x.
Lengths
[0];
4659
nint dim2 = y.
Lengths
[0];
4685
if (x.
Lengths
[1] != y.
Lengths
[1])
4686
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4688
nint dim1 = x.
Lengths
[0];
4689
nint dim2 = y.
Lengths
[0];
4692
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4703
int rowLength = (int)x.
Lengths
[1];
4708
lspan = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref x._reference, TensorSpanHelpers.ComputeLinearIndex(leftIndexes, x.Strides, x.
Lengths
)), (int)rowLength);
4709
rspan = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref y._reference, TensorSpanHelpers.ComputeLinearIndex(rightIndexes, y.Strides, y.
Lengths
)), (int)rowLength);
4740
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4775
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4814
Tensor<T> output = Create<T>(x.
Lengths
);
4827
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4842
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4844
output = Tensor.Create<T>(x.
Lengths
);
4848
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4914
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4939
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4962
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4983
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5004
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5025
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5046
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5072
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5074
output = Tensor.Create<T>(x.
Lengths
);
5078
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5108
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5110
output = Tensor.Create<T>(x.
Lengths
);
5114
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5138
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5160
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
5183
Tensor<int> output = Tensor.Create<int>(x.
Lengths
, x.Strides);
5252
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5277
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5300
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5302
output = Tensor.Create<T>(x.
Lengths
);
5306
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5329
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5354
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5379
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5404
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5429
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5454
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5487
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5489
output = Tensor.Create<T>(x.
Lengths
);
5493
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5516
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5548
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5550
output = Tensor.Create<T>(x.
Lengths
);
5554
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5577
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5609
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5611
output = Tensor.Create<T>(x.
Lengths
);
5615
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5638
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5670
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5672
output = Tensor.Create<T>(x.
Lengths
);
5676
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5699
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5731
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5733
output = Tensor.Create<T>(x.
Lengths
);
5737
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5760
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5792
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5794
output = Tensor.Create<T>(x.
Lengths
);
5798
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5821
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5853
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5855
output = Tensor.Create<T>(x.
Lengths
);
5859
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5882
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5914
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5916
output = Tensor.Create<T>(x.
Lengths
);
5920
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5943
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5968
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5983
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5985
output = Tensor.Create<T>(x.
Lengths
);
5989
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6031
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6064
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6085
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6108
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6110
output = Tensor.Create<T>(x.
Lengths
);
6114
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6137
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6159
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
6192
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6213
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6235
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6265
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6296
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6325
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6346
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6374
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6401
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6429
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6452
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6475
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6496
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6517
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6540
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6566
Tensor<T> output = Create<T>(x.
Lengths
);
6579
Tensor<T> output = Create<T>(y.
Lengths
);
6593
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6595
output = Tensor.Create<T>(x.
Lengths
);
6599
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6675
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6696
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6717
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6738
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6759
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6782
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6784
output = Tensor.Create<T>(x.
Lengths
);
6788
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6813
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6907
nint[] newLengths = Tensor.GetSmallestBroadcastableLengths(left.
Lengths
, right.
Lengths
);
6943
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
6945
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
6951
curIndex = stackalloc nint[input.
Lengths
.Length];
6956
nint rowLength = input.
Lengths
[^1];
6964
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
6995
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
6997
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
7003
curIndex = stackalloc nint[input.
Lengths
.Length];
7008
nint rowLength = input.
Lengths
[^1];
7016
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
7047
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
7049
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
7055
curIndex = stackalloc nint[input.
Lengths
.Length];
7060
nint rowLength = input.
Lengths
[^1];
7068
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
7080
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(left.
Lengths
, right.
Lengths
);
7136
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7146
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.
Lengths
)), (int)rowLength);
7149
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7159
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.
Lengths
)), (int)rowLength);
7162
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7172
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.
Lengths
)), (int)rowLength);
7173
rspan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.
Lengths
)), (int)rowLength);
7176
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);