Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public XArray(IntPtr ptr, long[] sizes, DType dtype)
        {
            Sizes      = sizes;
            this.dtype = dtype;
            strides    = GetContiguousStride(Sizes);
            long byteSize = dtype.Size() * Count;

            NativePtr = ptr;
        }
Ejemplo n.º 3
0
        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;
        }