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