11 writes to _shape
System.Numerics.Tensors (11)
System\Numerics\Tensors\netcore\TensorSpan_1.cs (11)
38
_shape
= TensorShape.Create(array);
55
_shape
= TensorShape.Create(array, lengths, strides);
67
_shape
= TensorShape.Create(array, start, lengths, strides);
77
_shape
= TensorShape.Create(ref reference, span.Length, pinned: false);
89
_shape
= TensorShape.Create(ref reference, span.Length, lengths, strides, pinned: false);
99
_shape
= TensorShape.Create(array);
111
_shape
= TensorShape.Create(array, start, lengths, strides, out nint linearOffset);
121
_shape
= TensorShape.Create(data, dataLength);
134
_shape
= TensorShape.Create(data, dataLength, lengths, strides);
140
_shape
= TensorShape.CreateForView(dataLength, lengths, strides, pinned);
147
_shape
= shape;
84 references to _shape
System.Numerics.Tensors (84)
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (1)
457
TensorShape.AreCompatible(destination.
_shape
, _shape, false))
System\Numerics\Tensors\netcore\Tensor.cs (20)
231
ReadOnlySpan<nint> destinationLengths = TensorShape.Normalize(destination.
_shape
).Lengths;
260
if (destination.
_shape
.IsSelfOverlapping)
270
nint destinationLinearLength = destination.
_shape
.LinearLength;
294
alignedTarget = new TensorSpan<T>(ref destination._reference, TensorShape.WithRank(destination.
_shape
, rank));
479
? TensorOperation.GetDenseSliceDimension(destination.
_shape
, destination.
_shape
)
536
? TensorOperation.GetDenseSliceDimension(destination.
_shape
, destination.
_shape
)
1623
return new Tensor<T>(tensor._values, tensor._start, reshaped.
_shape
);
1657
ref readonly TensorShape shape = ref TensorShape.Normalize(tensor.
_shape
);
1668
TensorSpan<T> result = new TensorSpan<T>(ref tensor._reference, tensor.
_shape
.LinearLength, newLengths, strides, tensor.IsPinned);
1798
if (destination.
_shape
.IsSelfOverlapping)
1827
if (tensor._shape.Overlaps(in tensor._reference, ref destination._reference, destination.
_shape
.LinearLength))
1908
if (tensor._shape.Overlaps(in tensor._reference, ref destination._reference, destination.
_shape
.LinearLength))
1911
&& TensorShape.AreLayoutsTheSame(tensor._shape, destination.
_shape
))
2324
TensorSpan<T> output = new TensorSpan<T>(ref tensor._reference, tensor.
_shape
.LinearLength, lengths[..rank], strides[..rank], tensor.IsPinned);
2721
if (!TensorShape.AreCompatible(destination.
_shape
, tensor._shape, false))
2742
return new Tensor<T>(tensor._values, tensor._start, unsqueezed.
_shape
);
2789
ref readonly TensorShape shape = ref TensorShape.Normalize(tensor.
_shape
);
2821
TensorSpan<T> output = new TensorSpan<T>(ref tensor._reference, tensor.
_shape
.LinearLength, newLengths, newStrides, tensor.IsPinned);
System\Numerics\Tensors\netcore\TensorDimensionSpan_1.cs (2)
24
tensor = new TensorSpan<T>(ref tensor._reference, TensorShape.Normalize(tensor.
_shape
));
59
nint linearOffset = _tensor.
_shape
.GetLinearOffsetForDimension(index, _dimension);
System\Numerics\Tensors\netcore\TensorOperation.cs (40)
28
if (!source._shape.Overlaps(in source._reference, ref destination._reference, destination.
_shape
.LinearLength))
37
&& TensorShape.AreLayoutsTheSame(source._shape, destination.
_shape
))
287
if (GetDenseSliceDimension(x.
_shape
, x.
_shape
) is int dimension && dimension >= 0)
302
linearOffset = x.
_shape
.AdjustToNextIndex(x.
_shape
, linearOffset, indexes);
406
if (GetDenseSliceDimension(destination.
_shape
, destination.
_shape
) is int dimension && dimension >= 0)
421
linearOffset = destination.
_shape
.AdjustToNextIndex(destination.
_shape
, linearOffset, indexes);
460
ReadOnlyTensorSpan<TArg> optimizedSource = x.Lengths.SequenceEqual(destinationLengths) ? x : BroadcastSource(x, destination.
_shape
);
469
int dimension = GetDenseSliceDimension(optimizedSource._shape, destination.
_shape
);
491
xLinearOffset = source._shape.AdjustToNextIndex(destination.
_shape
, xLinearOffset, xIndexes);
492
destinationLinearOffset = destination.
_shape
.AdjustToNextIndex(destination.
_shape
, destinationLinearOffset, destinationIndexes);
510
ReadOnlyTensorSpan<TArg> source = x.Lengths.SequenceEqual(destinationLengths) ? x : BroadcastSource(x, destination.
_shape
);
519
nint destinationLinearOffset = destination.
_shape
.LinearLength - 1 - negInnermostStride;
523
xLinearOffset = source._shape.AdjustToNextIndex(destination.
_shape
, xLinearOffset, xIndexes);
524
destinationLinearOffset = destination.
_shape
.AdjustToPreviousIndex(destination.
_shape
, destinationLinearOffset, destinationIndexes);
618
ReadOnlyTensorSpan<TArg1> optimizedX = x.Lengths.SequenceEqual(destinationLengths) ? x : BroadcastSource(x, destination.
_shape
);
619
ReadOnlyTensorSpan<TArg2> optimizedY = y.Lengths.SequenceEqual(destinationLengths) ? y : BroadcastSource(y, destination.
_shape
);
628
int dimension = GetDenseSliceDimension(optimizedX._shape, destination.
_shape
, optimizedY._shape, MinSlicedBinaryOperationLength);
654
xLinearOffset = left._shape.AdjustToNextIndex(destination.
_shape
, xLinearOffset, xIndexes);
655
yLinearOffset = right._shape.AdjustToNextIndex(destination.
_shape
, yLinearOffset, yIndexes);
656
destinationLinearOffset = destination.
_shape
.AdjustToNextIndex(destination.
_shape
, destinationLinearOffset, destinationIndexes);
712
ReadOnlyTensorSpan<TArg1> optimizedSource = x.Lengths.SequenceEqual(destinationLengths) ? x : BroadcastSource(x, destination.
_shape
);
721
int dimension = GetDenseSliceDimension(optimizedSource._shape, destination.
_shape
);
743
xLinearOffset = source._shape.AdjustToNextIndex(destination.
_shape
, xLinearOffset, xIndexes);
744
destinationLinearOffset = destination.
_shape
.AdjustToNextIndex(destination.
_shape
, destinationLinearOffset, destinationIndexes);
763
ReadOnlyTensorSpan<TArg> optimizedSource = y.Lengths.SequenceEqual(destinationLengths) ? y : BroadcastSource(y, destination.
_shape
);
772
int dimension = GetDenseSliceDimension(optimizedSource._shape, destination.
_shape
);
794
xLinearOffset = source._shape.AdjustToNextIndex(destination.
_shape
, xLinearOffset, xIndexes);
795
destinationLinearOffset = destination.
_shape
.AdjustToNextIndex(destination.
_shape
, destinationLinearOffset, destinationIndexes);
847
if (!TensorShape.AreCompatible(destination.
_shape
, x._shape, false))
856
if (TensorShape.AreCompatible(destination.
_shape
, x._shape, false))
858
if (TensorShape.AreCompatible(destination.
_shape
, y._shape, false))
System\Numerics\Tensors\netcore\TensorSpan_1.cs (21)
153
get => ref Unsafe.Add(ref _reference,
_shape
.GetLinearOffset<TensorShape.GetOffsetAndLengthForNInt, nint>(indexes));
159
get => ref Unsafe.Add(ref _reference,
_shape
.GetLinearOffset<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(indexes));
170
public nint FlattenedLength =>
_shape
.FlattenedLength;
173
public bool HasAnyDenseDimensions =>
_shape
.HasAnyDenseDimensions;
176
public bool IsDense =>
_shape
.IsDense;
179
public bool IsEmpty =>
_shape
.IsEmpty;
182
public bool IsPinned =>
_shape
.IsPinned;
186
public ReadOnlySpan<nint> Lengths =>
_shape
.Lengths;
193
public ReadOnlySpan<nint> Strides =>
_shape
.Strides;
198
&& left.
_shape
== right.
_shape
;
212
new ReadOnlyTensorSpan<T>(ref tensor._reference, tensor.
_shape
);
215
public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan() => new ReadOnlyTensorSpan<T>(ref _reference, in
_shape
);
274
if (
_shape
.FlattenedLength != 0) ret = ref _reference;
301
TensorShape shape =
_shape
.Slice<TensorShape.GetOffsetAndLengthForSlice, nint>(startIndexes, out nint linearOffset);
311
TensorShape shape =
_shape
.Slice<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
321
TensorShape shape =
_shape
.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
344
nint longestContiguousLength =
_shape
.GetLongestContiguousLength<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset);
360
nint longestContiguousLength =
_shape
.GetLongestContiguousLength<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
495
if (_itemsEnumerated == _span.
_shape
.FlattenedLength)
503
: _span.
_shape
.GetLinearOffsetForDimension(_itemsEnumerated, _span.Rank);