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)
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]);
3582
T[] values = new T[tensor.
Lengths
[tensor.Rank - 1]];
3585
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]);
3591
TensorSpanHelpers.AdjustIndexes(tensor.Rank - 2, 1, curIndexes, tensor.
Lengths
);
3592
copiedValues += tensor.
Lengths
[tensor.Rank - 1];
3661
if (!TensorHelpers.IsBroadcastableTo(tensor.
Lengths
, destination.Lengths))
3664
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(tensor.
Lengths
, destination.Lengths);
3755
if (dimension > tensor.
Lengths
.Length)
3760
Span<nint> lengths = tensor.
Lengths
.Length + 1 <= TensorShape.MaxInlineRank ?
3761
stackalloc nint[tensor.
Lengths
.Length + 1] :
3762
new nint[tensor.
Lengths
.Length + 1];
3763
tensor.
Lengths
.Slice(0, dimension).CopyTo(lengths);
3764
tensor.
Lengths
.Slice(dimension).CopyTo(lengths.Slice(dimension + 1));
3779
strides[dimension] = tensor.Strides[dimension] * tensor.
Lengths
[dimension];
3795
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3820
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3845
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3870
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3897
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
3899
output = Tensor.Create<T>(x.
Lengths
);
3903
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
3918
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3956
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
3981
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4006
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4031
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4058
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4060
output = Tensor.Create<T>(x.
Lengths
);
4064
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4091
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4117
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4146
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4148
output = Tensor.Create<T>(x.
Lengths
);
4152
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4179
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4205
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4233
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4258
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
);
4347
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4349
output = Tensor.Create<T>(x.
Lengths
);
4353
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4380
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4407
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4432
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4459
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4489
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4519
Tensor<TTo> output = Tensor.Create<TTo>(source.
Lengths
);
4548
Tensor<T> output = Create<T>(x.
Lengths
);
4563
if (x.
Lengths
.SequenceEqual(sign.
Lengths
))
4565
output = Tensor.Create<T>(x.
Lengths
);
4569
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, sign.
Lengths
));
4609
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4634
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4666
if (x.
Lengths
[1] != y.
Lengths
[1])
4667
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4669
nint dim1 = x.
Lengths
[0];
4670
nint dim2 = y.
Lengths
[0];
4696
if (x.
Lengths
[1] != y.
Lengths
[1])
4697
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4699
nint dim1 = x.
Lengths
[0];
4700
nint dim2 = y.
Lengths
[0];
4703
ThrowHelper.ThrowArgument_IncompatibleDimensions(x.
Lengths
[1], y.
Lengths
[1]);
4714
int rowLength = (int)x.
Lengths
[1];
4719
lspan = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref x._reference, TensorSpanHelpers.ComputeLinearIndex(leftIndexes, x.Strides, x.
Lengths
)), (int)rowLength);
4720
rspan = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.Add(ref y._reference, TensorSpanHelpers.ComputeLinearIndex(rightIndexes, y.Strides, y.
Lengths
)), (int)rowLength);
4751
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4786
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4825
Tensor<T> output = Create<T>(x.
Lengths
);
4838
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
4853
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
4855
output = Tensor.Create<T>(x.
Lengths
);
4859
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
4925
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4950
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4973
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
4994
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5015
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5036
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5057
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5083
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5085
output = Tensor.Create<T>(x.
Lengths
);
5089
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5119
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5121
output = Tensor.Create<T>(x.
Lengths
);
5125
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5149
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5171
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
5194
Tensor<int> output = Tensor.Create<int>(x.
Lengths
, x.Strides);
5263
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5288
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5311
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5313
output = Tensor.Create<T>(x.
Lengths
);
5317
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5340
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5365
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5390
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5415
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5440
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5465
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5498
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5500
output = Tensor.Create<T>(x.
Lengths
);
5504
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5527
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5559
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5561
output = Tensor.Create<T>(x.
Lengths
);
5565
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5588
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5620
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5622
output = Tensor.Create<T>(x.
Lengths
);
5626
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5649
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5681
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5683
output = Tensor.Create<T>(x.
Lengths
);
5687
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5710
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5742
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5744
output = Tensor.Create<T>(x.
Lengths
);
5748
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5771
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5803
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5805
output = Tensor.Create<T>(x.
Lengths
);
5809
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5832
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5864
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5866
output = Tensor.Create<T>(x.
Lengths
);
5870
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5893
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5925
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5927
output = Tensor.Create<T>(x.
Lengths
);
5931
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
5954
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5979
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
5994
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
5996
output = Tensor.Create<T>(x.
Lengths
);
6000
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6042
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6075
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6096
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6119
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6121
output = Tensor.Create<T>(x.
Lengths
);
6125
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6148
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6170
Tensor<T> output = Tensor.Create<T>(y.
Lengths
);
6203
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6224
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6246
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6276
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6307
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6336
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6357
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6385
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6412
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6440
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6463
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6486
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6507
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6528
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6551
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6577
Tensor<T> output = Create<T>(x.
Lengths
);
6590
Tensor<T> output = Create<T>(y.
Lengths
);
6604
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6606
output = Tensor.Create<T>(x.
Lengths
);
6610
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6673
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6694
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6715
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6736
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6757
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6780
if (x.
Lengths
.SequenceEqual(y.
Lengths
))
6782
output = Tensor.Create<T>(x.
Lengths
);
6786
output = Tensor.Create<T>(GetSmallestBroadcastableLengths(x.
Lengths
, y.
Lengths
));
6811
Tensor<T> output = Tensor.Create<T>(x.
Lengths
);
6905
nint[] newLengths = Tensor.GetSmallestBroadcastableLengths(left.
Lengths
, right.
Lengths
);
6941
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
6943
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
6949
curIndex = stackalloc nint[input.
Lengths
.Length];
6954
nint rowLength = input.
Lengths
[^1];
6962
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
6993
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
6995
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
7001
curIndex = stackalloc nint[input.
Lengths
.Length];
7006
nint rowLength = input.
Lengths
[^1];
7014
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
7045
if (input.
Lengths
.Length > TensorShape.MaxInlineRank)
7047
curIndexArray = ArrayPool<nint>.Shared.Rent(input.
Lengths
.Length);
7053
curIndex = stackalloc nint[input.
Lengths
.Length];
7058
nint rowLength = input.
Lengths
[^1];
7066
TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.
Lengths
);
7078
nint[] newSize = Tensor.GetSmallestBroadcastableLengths(left.
Lengths
, right.
Lengths
);
7134
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7144
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.
Lengths
)), (int)rowLength);
7147
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7157
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.
Lengths
)), (int)rowLength);
7160
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.
Lengths
);
7170
ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.
Lengths
)), (int)rowLength);
7171
rspan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.
Lengths
)), (int)rowLength);
7174
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);