Beispiel #1
0
        public static void MXPredSetInput(PredictorHandle handle, string key, float[] data, uint size)
        {
            if (handle == null)
            {
                throw new ArgumentNullException(nameof(handle));
            }

            handle.ThrowIfDisposed();

            var ret = NativeMethods.MXPredSetInput(handle.NativePtr, key, data, size);

            if (ret != NativeMethods.OK)
            {
                throw CreateMXNetException($"Failed to input {nameof(handle)}");
            }
        }
Beispiel #2
0
        public static void MXPredPartialForward(PredictorHandle handle, int step, out int step_left)
        {
            if (handle == null)
            {
                throw new ArgumentNullException(nameof(handle));
            }

            handle.ThrowIfDisposed();

            var ret = NativeMethods.MXPredPartialForward(handle.NativePtr, step, out step_left);

            if (ret != NativeMethods.OK)
            {
                throw CreateMXNetException($"Failed to partial forward {nameof(handle)}");
            }
        }
Beispiel #3
0
        public static void MXPredGetOutput(PredictorHandle handle, uint index, float[] data, uint size)
        {
            if (handle == null)
            {
                throw new ArgumentNullException(nameof(handle));
            }

            handle.ThrowIfDisposed();

            var ret = NativeMethods.MXPredGetOutput(handle.NativePtr, index, data, size);

            if (ret != NativeMethods.OK)
            {
                throw CreateMXNetException($"Failed to get output from {nameof(handle)}");
            }
        }
Beispiel #4
0
        public static void MXPredForward(PredictorHandle handle)
        {
            if (handle == null)
            {
                throw new ArgumentNullException(nameof(handle));
            }

            handle.ThrowIfDisposed();

            var ret = NativeMethods.MXPredForward(handle.NativePtr);

            if (ret != NativeMethods.OK)
            {
                throw CreateMXNetException($"Failed to forward {nameof(handle)}");
            }
        }
Beispiel #5
0
        public static void MXPredGetOutputShape(PredictorHandle handle, uint index, out uint[] shape_data, out uint shape_ndim)
        {
            if (handle == null)
            {
                throw new ArgumentNullException(nameof(handle));
            }

            handle.ThrowIfDisposed();

            var ret = NativeMethods.MXPredGetOutputShape(handle.NativePtr, index, out var shape_data_ptr, out shape_ndim);

            if (ret != NativeMethods.OK)
            {
                throw CreateMXNetException($"Failed to get output shape from {nameof(handle)}");
            }

            shape_data = new uint[shape_ndim];
            NativeMethods.memcpy(shape_data, shape_data_ptr, shape_ndim * sizeof(uint));
        }