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