9 instantiations of TensorShape
System.Numerics.Tensors (9)
System\Numerics\Tensors\netcore\TensorShape.cs (9)
724TensorShape result = new TensorShape( 823TensorShape result = new TensorShape(linearLength - computedOffset, lengths, strides, TensorFlags.None); 848return new TensorShape(linearLength: -1, lengths: lengths, strides: strides, flags: flags); 856return new TensorShape( 871return new TensorShape(array.Length, lengths, strides, TensorFlags.None); 893return new TensorShape(linearLength, lengths, strides, TensorFlags.None); 914return new TensorShape( 934return new TensorShape(linearLength, lengths, strides, flags); 1198TensorShape result = new TensorShape(
111 references to TensorShape
System.Numerics.Tensors (111)
System\Numerics\Tensors\netcore\ReadOnlyTensorDimensionSpan_1.cs (2)
20private readonly TensorShape _sliceShape; 33_sliceShape = TensorShape.Create((dimension != tensor.Rank) ? tensor.Lengths[dimension..] : [1], tensor.Strides[dimension..], tensor.IsPinned);
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (23)
32internal readonly TensorShape _shape; 43_shape = TensorShape.Create(array); 78_shape = TensorShape.Create(array, lengths, strides); 102_shape = TensorShape.Create(array, start, lengths, strides); 114_shape = TensorShape.Create(ref reference, span.Length, pinned: false); 144_shape = TensorShape.Create(ref reference, span.Length, lengths, strides, pinned: false); 156_shape = TensorShape.Create(array); 183_shape = TensorShape.Create(array, start, lengths, strides, out nint linearOffset); 198_shape = TensorShape.Create(data, dataLength); 237_shape = TensorShape.Create(data, dataLength, lengths, strides); 243_shape = TensorShape.Create(in data, dataLength, lengths, strides, pinned); 247internal ReadOnlyTensorSpan(ref readonly T reference, scoped in TensorShape shape) 256get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNInt, nint>(indexes)); 262get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(indexes)); 408TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset); 418TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset); 428TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset); 442if (TensorShape.AreCompatible(destination._shape, _shape, false)) 465nint longestContiguousLength = _shape.GetLongestContiguousLength<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset); 481nint longestContiguousLength = _shape.GetLongestContiguousLength<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);
System\Numerics\Tensors\netcore\Tensor.cs (7)
237if (!TensorShape.AreLengthsTheSame(destination.Lengths, lengths)) 272hasMore = TensorShape.AdjustToNextIndex(ranges, dimension - 1, destination.Lengths); 333TensorShape shape = TensorShape.Create(lengths, strides, pinned); 2113TensorShape tmpShape = TensorShape.Create(tensor.Lengths[1..], tensor.Strides[1..], tensor.IsPinned); 2226if (!TensorShape.AreCompatible(destination._shape, tensor._shape, false))
System\Numerics\Tensors\netcore\Tensor_1.cs (15)
23internal readonly TensorShape _shape; 29_shape = TensorShape.Create(lengths, strides, pinned); 36_shape = TensorShape.Create(array); 43_shape = TensorShape.Create(array, lengths, strides); 50_shape = TensorShape.Create(array, start, lengths, strides); 55internal Tensor(T[] array, in TensorShape shape) 64internal Tensor(T[] array, int start, in TensorShape shape) 83get => ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_values), _start + _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNInt, nint>(indexes)); 89get => ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_values), _start + _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(indexes)); 217TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset); 232TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset); 247TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
System\Numerics\Tensors\netcore\TensorDimensionSpan_1.cs (2)
17private readonly TensorShape _sliceShape; 30_sliceShape = TensorShape.Create((dimension != tensor.Rank) ? tensor.Lengths[dimension..] : [1], tensor.Strides[dimension..], tensor.IsPinned);
System\Numerics\Tensors\netcore\TensorOperation.cs (11)
34ref readonly TensorShape destinationShape = ref ((x._shape.FlattenedLength > y._shape.FlattenedLength) ? ref x._shape : ref y._shape); 226ref readonly TensorShape destinationShape = ref ((x._shape.FlattenedLength > y._shape.FlattenedLength) ? ref x._shape : ref y._shape); 324if (!TensorShape.AreCompatible(lengths, x._shape)) 331if (!TensorShape.AreCompatible(x._shape, y._shape, true)) 338if (!TensorShape.AreCompatible(destination._shape, x._shape, false)) 345if (TensorShape.AreCompatible(x._shape, y._shape, true)) 347if (TensorShape.AreCompatible(destination._shape, x._shape, false)) 349if (TensorShape.AreCompatible(destination._shape, y._shape, false)) 362if (TensorShape.AreCompatible(x._shape, y._shape, true)) 2634private TensorShape.InlineBuffer<T> _inline; 2638if (rank > TensorShape.MaxInlineRank)
System\Numerics\Tensors\netcore\TensorShape.cs (29)
44internal readonly struct TensorShape : IEquatable<TensorShape> 364public static bool operator ==(in TensorShape left, in TensorShape right) 405public static bool operator !=(in TensorShape left, in TensorShape right) => !(left == right); 407public nint AdjustToNextIndex(in TensorShape destinationShape, nint linearOffset, Span<nint> indexes) 472public nint AdjustToPreviousIndex(in TensorShape destinationShape, nint linearOffset, Span<nint> indexes) 560public static bool AreCompatible(in TensorShape shape1, in TensorShape shape2, bool allowBidirectional) 571ref readonly TensorShape tmpShape = ref shape1; 641public static bool AreCompatible(in ReadOnlySpan<nint> shape1Lengths, in TensorShape shape2) 687public static bool AreLengthsTheSame(in TensorShape shape1, in TensorShape shape2) 697public static TensorShape Create(Array? array) 724TensorShape result = new TensorShape( 740public static TensorShape Create(Array? array, scoped ReadOnlySpan<int> start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, out nint linearOffset) 823TensorShape result = new TensorShape(linearLength - computedOffset, lengths, strides, TensorFlags.None); 845public static TensorShape Create(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned) 851public static TensorShape Create<T>(T[]? array) 867public static TensorShape Create<T>(T[]? array, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 881public static TensorShape Create<T>(T[]? array, int start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 907public static TensorShape Create<T>(ref readonly T reference, nint linearLength, bool pinned) 929public static TensorShape Create<T>(ref readonly T reference, nint linearLength, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned) 948public static unsafe TensorShape Create<T>(T* address, nint linearLength) 951public static unsafe TensorShape Create<T>(T* address, nint linearLength, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides = default) 955=> (obj is TensorShape other) && (this == other); 957public bool Equals(TensorShape other) => (this == other); 1089public TensorShape Slice<TGetOffsetAndLength, T>(ReadOnlySpan<T> state, out nint linearOffset) 1198TensorShape result = new TensorShape(
System\Numerics\Tensors\netcore\TensorSpan_1.cs (22)
32internal readonly TensorShape _shape; 41_shape = TensorShape.Create(array); 58_shape = TensorShape.Create(array, lengths, strides); 70_shape = TensorShape.Create(array, start, lengths, strides); 80_shape = TensorShape.Create(ref reference, span.Length, pinned: false); 92_shape = TensorShape.Create(ref reference, span.Length, lengths, strides, pinned: false); 102_shape = TensorShape.Create(array); 114_shape = TensorShape.Create(array, start, lengths, strides, out nint linearOffset); 124_shape = TensorShape.Create(data, dataLength); 137_shape = TensorShape.Create(data, dataLength, lengths, strides); 143_shape = TensorShape.Create(ref data, dataLength, lengths, strides, pinned); 147internal TensorSpan(ref T reference, scoped in TensorShape shape) 156get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNInt, nint>(indexes)); 162get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(indexes)); 304TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset); 314TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset); 324TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset); 344nint longestContiguousLength = _shape.GetLongestContiguousLength<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset); 360nint longestContiguousLength = _shape.GetLongestContiguousLength<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset);