12 instantiations of TensorShape
System.Numerics.Tensors (12)
System\Numerics\Tensors\netcore\TensorShape.cs (12)
782TensorShape result = new TensorShape( 881TensorShape result = new TensorShape(linearLength - computedOffset, lengths, strides, linearRankOrder: []); 904=> new TensorShape(linearLength: -1, lengths, strides: [], linearRankOrder: []); 907=> new TensorShape(linearLength: -1, lengths, strides, linearRankOrder: []); 915return new TensorShape( 933return new TensorShape(linearLength, lengths, strides: [], linearRankOrder: []); 948return new TensorShape(linearLength, lengths, strides, linearRankOrder: []); 970return new TensorShape(linearLength, lengths, strides, linearRankOrder: []); 996return new TensorShape(linearLength, lengths, strides, linearRankOrder); 1014return new TensorShape( 1041return new TensorShape(linearLength, lengths, strides, linearRankOrder); 1235TensorShape result = new TensorShape(
125 references to TensorShape
System.Numerics.Tensors (125)
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (27)
29internal readonly TensorShape _shape; 40_shape = TensorShape.Create(array); 58_shape = TensorShape.Create(array, lengths); 80_shape = TensorShape.Create(array, lengths, strides); 104_shape = TensorShape.Create(array, start, lengths, strides); 116_shape = TensorShape.Create(ref reference, span.Length); 131_shape = TensorShape.Create(ref reference, span.Length, lengths); 150_shape = TensorShape.Create(ref reference, span.Length, lengths, strides); 162_shape = TensorShape.Create(array); 189_shape = TensorShape.Create(array, start, lengths, strides, out nint linearOffset); 204_shape = TensorShape.Create(data, dataLength); 223_shape = TensorShape.Create(data, dataLength, lengths); 246_shape = TensorShape.Create(data, dataLength, lengths, strides); 253_shape = TensorShape.Create(ref data, dataLength); 259_shape = TensorShape.Create(ref data, dataLength, lengths); 265_shape = TensorShape.Create(ref data, dataLength, lengths, strides); 271_shape = TensorShape.Create(ref data, dataLength, lengths, strides, linearRankOrder); 275internal ReadOnlyTensorSpan(ref T reference, scoped in TensorShape shape) 284get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNInt, nint>(indexes)); 290get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(indexes)); 410TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset); 420TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset); 430TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset); 444if (TensorShape.AreCompatible(destination._shape, _shape, false))
System\Numerics\Tensors\netcore\Tensor.cs (8)
241if (!TensorShape.AreLengthsTheSame(destination.Lengths, lengths)) 437TensorShape shape = TensorShape.Create(lengths, strides: []); 445TensorShape shape = TensorShape.Create(lengths, strides); 2299TensorShape tmpShape = TensorShape.Create(tensor.Lengths[1..], tensor.Strides[1..]); 2419if (!TensorShape.AreCompatible(destination._shape, tensor._shape, false))
System\Numerics\Tensors\netcore\Tensor_1.cs (18)
25internal readonly TensorShape _shape; 33_shape = TensorShape.Create(lengths); 42_shape = TensorShape.Create(lengths, strides); 51_shape = TensorShape.Create(array); 60_shape = TensorShape.Create(array, lengths); 69_shape = TensorShape.Create(array, lengths, strides); 78_shape = TensorShape.Create(array, start, lengths, strides); 87_shape = TensorShape.Create(array, start, lengths, strides, linearRankOrder); 94internal Tensor(T[] array, in TensorShape shape, bool isPinned) 105internal Tensor(T[] array, int start, in TensorShape shape, bool isPinned) 128get => ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_values), _start + _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNInt, nint>(indexes)); 134get => ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_values), _start + _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(indexes)); 252TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset); 268TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset); 284TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
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 (35)
48internal readonly struct TensorShape : IEquatable<TensorShape> 434public static bool operator ==(in TensorShape left, in TensorShape right) 485public static bool operator !=(in TensorShape left, in TensorShape right) => !(left == right); 487public nint AdjustToNextIndex(in TensorShape destinationShape, nint linearOffset, Span<nint> indexes) 552public nint AdjustToPreviousIndex(in TensorShape destinationShape, nint linearOffset, Span<nint> indexes) 618public static bool AreCompatible(in TensorShape shape1, in TensorShape shape2, bool allowBidirectional) 629ref readonly TensorShape tmpShape = ref shape1; 699public static bool AreCompatible(in ReadOnlySpan<nint> shape1Lengths, in TensorShape shape2) 745public static bool AreLengthsTheSame(in TensorShape shape1, in TensorShape shape2) 755public static TensorShape Create(Array? array) 782TensorShape result = new TensorShape( 798public static TensorShape Create(Array? array, scoped ReadOnlySpan<int> start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, out nint linearOffset) 881TensorShape result = new TensorShape(linearLength - computedOffset, lengths, strides, linearRankOrder: []); 903public static TensorShape Create(scoped ReadOnlySpan<nint> lengths) 906public static TensorShape Create(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 909public static TensorShape Create<T>(T[]? array) 928public static TensorShape Create<T>(T[]? array, scoped ReadOnlySpan<nint> lengths) 943public static TensorShape Create<T>(T[]? array, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 958public static TensorShape Create<T>(T[]? array, int start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 984public static TensorShape Create<T>(T[]? array, int start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, scoped ReadOnlySpan<int> linearRankOrder) 1010public static TensorShape Create<T>(ref T reference, nint linearLength) 1031public static TensorShape Create<T>(ref T reference, nint linearLength, scoped ReadOnlySpan<nint> lengths) 1034public static TensorShape Create<T>(ref T reference, nint linearLength, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 1037public static TensorShape Create<T>(ref T reference, nint linearLength, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, scoped ReadOnlySpan<int> linearRankOrder) 1055public static unsafe TensorShape Create<T>(T* address, nint linearLength) 1058public static unsafe TensorShape Create<T>(T* address, nint linearLength, scoped ReadOnlySpan<nint> lengths) 1061public static unsafe TensorShape Create<T>(T* address, nint linearLength, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 1065=> (obj is TensorShape other) && (this == other); 1067public bool Equals(TensorShape other) => (this == other); 1117public TensorShape Slice<TGetOffsetAndLength, T>(ReadOnlySpan<T> state, out nint linearOffset) 1235TensorShape result = new TensorShape(
System\Numerics\Tensors\netcore\TensorSpan.cs (26)
29internal readonly TensorShape _shape; 38_shape = TensorShape.Create(array); 50_shape = TensorShape.Create(array, lengths); 62_shape = TensorShape.Create(array, lengths, strides); 74_shape = TensorShape.Create(array, start, lengths, strides); 84_shape = TensorShape.Create(ref reference, span.Length); 92_shape = TensorShape.Create(ref reference, span.Length, lengths); 100_shape = TensorShape.Create(ref reference, span.Length, lengths, strides); 110_shape = TensorShape.Create(array); 122_shape = TensorShape.Create(array, start, lengths, strides, out nint linearOffset); 132_shape = TensorShape.Create(data, dataLength); 140_shape = TensorShape.Create(data, dataLength, lengths); 148_shape = TensorShape.Create(data, dataLength, lengths, strides); 154_shape = TensorShape.Create(ref data, dataLength); 160_shape = TensorShape.Create(ref data, dataLength, lengths); 166_shape = TensorShape.Create(ref data, dataLength, lengths, strides); 172_shape = TensorShape.Create(ref data, dataLength, lengths, strides, linearRankOrder); 176internal TensorSpan(ref T reference, scoped in TensorShape shape) 185get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNInt, nint>(indexes)); 191get => ref Unsafe.Add(ref _reference, _shape.GetLinearOffset<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(indexes)); 307TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset); 317TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset); 327TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);