public NDArray(uint[] shape) { NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreate(shape, (uint)shape.Length, DeviceType.KCpu, 0, 0, out handle)); _blob_ptr = new NDBlob(handle); }
public NDArray() { NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreateNone(out handle)); _blob_ptr = new NDBlob(handle); }
public NDArray(Shape shape, Context context, bool delay_alloc) { NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreate(shape.Data().ToArray(), shape.Ndim(), context.device_type, context.device_id, delay_alloc ? 1 : 0, out handle)); _blob_ptr = new NDBlob(handle); }
public NDArray(float[] data) { NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreateNone(out handle)); NativeMethods.MXNDArraySyncCopyFromCPU(handle, data, (uint)data.Length); _blob_ptr = new NDBlob(handle); }
public NDArray(uint[] shape, Context context, bool delay_alloc) { NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreate(shape, (uint)shape.Length, context.device_type, context.device_id, delay_alloc ? 1 : 0, out handle)); _blob_ptr = new NDBlob(handle); }
public NDArray(float[] data, Shape shape, Context context = null) { if (context == null) { context = Context.default_ctx; } NDArrayHandle handle; Util.CallCheck(NativeMethods.MXNDArrayCreate(shape.Data().ToArray(), shape.Ndim(), context.device_type, context.device_id, 0, out handle)); NativeMethods.MXNDArraySyncCopyFromCPU(handle, data, shape.Size()); _blob_ptr = new NDBlob(handle); }
public NDArray(NDArrayHandle handle, bool writable = true) { _writable = writable; _blob_ptr = new NDBlob(handle); }