9 instantiations of TensorShape
System.Numerics.Tensors (9)
System\Numerics\Tensors\netcore\TensorShape.cs (9)
729TensorShape result = new TensorShape( 828TensorShape result = new TensorShape(linearLength - computedOffset, lengths, strides, TensorFlags.None); 853return new TensorShape(linearLength: -1, lengths: lengths, strides: strides, flags: flags); 861return new TensorShape( 876return new TensorShape(array.Length, lengths, strides, TensorFlags.None); 898return new TensorShape(linearLength, lengths, strides, TensorFlags.None); 919return new TensorShape( 939return new TensorShape(linearLength, lengths, strides, flags); 1143TensorShape result = new TensorShape(
107 references to TensorShape
System.Numerics.Tensors (107)
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 (21)
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(ref data, dataLength, lengths, strides, pinned); 247internal ReadOnlyTensorSpan(ref 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)); 388TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset); 398TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset); 408TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset); 422if (TensorShape.AreCompatible(destination._shape, _shape, false))
System\Numerics\Tensors\netcore\Tensor.cs (7)
238if (!TensorShape.AreLengthsTheSame(destination.Lengths, lengths)) 273hasMore = TensorShape.AdjustToNextIndex(ranges, dimension - 1, destination.Lengths); 421TensorShape shape = TensorShape.Create(lengths, strides, pinned); 2201TensorShape tmpShape = TensorShape.Create(tensor.Lengths[1..], tensor.Strides[1..], tensor.IsPinned); 2314if (!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)); 211TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset); 226TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset); 241TensorShape 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)
49internal readonly struct TensorShape : IEquatable<TensorShape> 369public static bool operator ==(in TensorShape left, in TensorShape right) 410public static bool operator !=(in TensorShape left, in TensorShape right) => !(left == right); 412public nint AdjustToNextIndex(in TensorShape destinationShape, nint linearOffset, Span<nint> indexes) 477public nint AdjustToPreviousIndex(in TensorShape destinationShape, nint linearOffset, Span<nint> indexes) 565public static bool AreCompatible(in TensorShape shape1, in TensorShape shape2, bool allowBidirectional) 576ref readonly TensorShape tmpShape = ref shape1; 646public static bool AreCompatible(in ReadOnlySpan<nint> shape1Lengths, in TensorShape shape2) 692public static bool AreLengthsTheSame(in TensorShape shape1, in TensorShape shape2) 702public static TensorShape Create(Array? array) 729TensorShape result = new TensorShape( 745public static TensorShape Create(Array? array, scoped ReadOnlySpan<int> start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, out nint linearOffset) 828TensorShape result = new TensorShape(linearLength - computedOffset, lengths, strides, TensorFlags.None); 850public static TensorShape Create(scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned) 856public static TensorShape Create<T>(T[]? array) 872public static TensorShape Create<T>(T[]? array, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 886public static TensorShape Create<T>(T[]? array, int start, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 912public static TensorShape Create<T>(ref T reference, nint linearLength, bool pinned) 934public static TensorShape Create<T>(ref T reference, nint linearLength, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides, bool pinned) 953public static unsafe TensorShape Create<T>(T* address, nint linearLength) 956public static unsafe TensorShape Create<T>(T* address, nint linearLength, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides = default) 960=> (obj is TensorShape other) && (this == other); 962public bool Equals(TensorShape other) => (this == other); 1034public TensorShape Slice<TGetOffsetAndLength, T>(ReadOnlySpan<T> state, out nint linearOffset) 1143TensorShape result = new TensorShape(
System\Numerics\Tensors\netcore\TensorSpan_1.cs (20)
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)); 284TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNInt, nint>(startIndexes, out nint linearOffset); 294TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNIndex, NIndex>(startIndexes, out nint linearOffset); 304TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);