Ejemplo n.º 1
0
		public unsafe static DLManagedTensor FromBlob<T>(T* data, Int32 ndim, Int64* shape, Int64* strides = null) where T : unmanaged
		{
			var dl_managed_tensor = new DLManagedTensor();
			dl_managed_tensor.dl_tensor.data = (IntPtr)data;
			dl_managed_tensor.dl_tensor.ctx.device_type = DLDeviceType.kDLCPU;
			dl_managed_tensor.dl_tensor.ndim = ndim;
			dl_managed_tensor.dl_tensor.dtype = DLDataType.From<T>();
			dl_managed_tensor.dl_tensor.shape = (IntPtr)shape;
			dl_managed_tensor.dl_tensor.strides = (IntPtr)strides;
			dl_managed_tensor.dl_tensor.byte_offset = 0;
			dl_managed_tensor.deleter = EmptyDeleter;
			return dl_managed_tensor;
		}
Ejemplo n.º 2
0
		public static void EmptyDeleter(ref DLManagedTensor self)
		{
		}