public NdArray(uint[] shape) { NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreate(shape, (uint)shape.Length, DeviceType.KCpu, 0, 0, out handle)); _blobPtr = new NdBlob(handle); }
public NdArray() { NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreateNone(out handle)); _blobPtr = new NdBlob(handle); }
public NdArray(Shape shape, Context context, bool delayAlloc) { NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreate(shape.Data().ToArray(), shape.Ndim(), context.DeviceType, context.DeviceId, delayAlloc ? 1 : 0, out handle)); _blobPtr = new NdBlob(handle); }
public NdArray(float[] data) { NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreateNone(out handle)); NativeMethods.MXNDArraySyncCopyFromCPU(handle, data, (uint)data.Length); _blobPtr = new NdBlob(handle); }
public NdArray(uint[] shape, Context context, bool delayAlloc) { NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreate(shape, (uint)shape.Length, context.DeviceType, context.DeviceId, delayAlloc ? 1 : 0, out handle)); _blobPtr = new NdBlob(handle); }
public NdArray(float[] data, Shape shape, Context context = null) { if (context == null) { context = Context.DefaultCtx; } NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreate(shape.Data().ToArray(), shape.Ndim(), context.DeviceType, context.DeviceId, 0, out handle)); NativeMethods.MXNDArraySyncCopyFromCPU(handle, data, shape.Size()); _blobPtr = new NdBlob(handle); }
public NdArray(NDArrayHandle handle, bool writable = true) { _writable = writable; _blobPtr = new NdBlob(handle); }