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