コード例 #1
0
        public static void Serialize(LossMmod net, string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException();
            }

            net.ThrowIfDisposed();

            var str   = Dlib.Encoding.GetBytes(path);
            var error = NativeMethods.LossMmod_serialize(net.NetworkType, net.NativePtr, str, out var errorMessage);

            switch (error)
            {
            case NativeMethods.ErrorType.DnnNotSupportNetworkType:
                throw new NotSupportNetworkTypeException(net.NetworkType);

            case NativeMethods.ErrorType.GeneralSerialization:
                throw new SerializationException(StringHelper.FromStdString(errorMessage, true));
            }
        }
コード例 #2
0
            internal LossDetails(LossMmod parent, IntPtr ptr)
                : base(false)
            {
                if (parent == null)
                {
                    throw new ArgumentNullException(nameof(parent));
                }

                parent.ThrowIfDisposed();

                this._Parent   = parent;
                this.NativePtr = ptr;
            }
コード例 #3
0
            internal Subnet(LossMmod parent)
            {
                if (parent == null)
                {
                    throw new ArgumentNullException(nameof(parent));
                }

                parent.ThrowIfDisposed();

                this._Parent = parent;

                var err = NativeMethods.loss_mmod_subnet(parent.NativePtr, parent.NetworkType, out var ret);

                this.NativePtr = ret;
            }
コード例 #4
0
        public static void Serialize(LossMmod net, string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException();
            }

            net.ThrowIfDisposed();

            var str = Dlib.Encoding.GetBytes(path);

            NativeMethods.loss_mmod_serialize(net.NativePtr, net.NetworkType, str);
        }
コード例 #5
0
        public static void Serialize(ProxySerialize serialize, LossMmod net)
        {
            if (serialize == null)
            {
                throw new ArgumentNullException(nameof(serialize));
            }
            if (net == null)
            {
                throw new ArgumentNullException(nameof(net));
            }

            net.ThrowIfDisposed();

            var error = NativeMethods.LossMmod_serialize_proxy(net.NetworkType, serialize.NativePtr, net.NativePtr, out var errorMessage);

            switch (error)
            {
            case NativeMethods.ErrorType.DnnNotSupportNetworkType:
                throw new NotSupportNetworkTypeException(net.NetworkType);

            case NativeMethods.ErrorType.GeneralSerialization:
                throw new SerializationException(StringHelper.FromStdString(errorMessage, true));
            }
        }