public XArray(Shape shape, DType dtype = DType.Float32) { Shape = shape; this.dtype = dtype; strides = GetContiguousStride(Shape.Data); long byteSize = dtype.Size() * shape.Size; NativePtr = Marshal.AllocHGlobal(new IntPtr(byteSize)); }
public XArray(IntPtr ptr, long[] sizes, DType dtype) { Sizes = sizes; this.dtype = dtype; strides = GetContiguousStride(Sizes); long byteSize = dtype.Size() * Count; NativePtr = ptr; }
public XArray(long[] sizes, DType dtype, Direction direction = Direction.Input) { Sizes = sizes; this.dtype = dtype; strides = GetContiguousStride(Sizes); long byteSize = dtype.Size() * Count; NativePtr = Marshal.AllocHGlobal(new IntPtr(byteSize)); Direction = direction; }