Example #1
0
            internal Subnet(LossMulticlassLog parent)
            {
                if (parent == null)
                {
                    throw new ArgumentNullException(nameof(parent));
                }

                parent.ThrowIfDisposed();

                this._Parent = parent;

                var err = Native.loss_multiclass_log_subnet(parent.NativePtr, parent.NetworkType, out var ret);

                this.NativePtr = ret;
            }
Example #2
0
        public static void Serialize(LossMulticlassLog net, string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException();
            }

            net.ThrowIfDisposed();

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

            Native.loss_multiclass_log_serialize(net.NativePtr, net.NetworkType, str);
        }
Example #3
0
        public static void Serialize(ProxySerialize serialize, LossMulticlassLog net)
        {
            if (serialize == null)
            {
                throw new ArgumentNullException(nameof(serialize));
            }
            if (net == null)
            {
                throw new ArgumentNullException(nameof(net));
            }

            net.ThrowIfDisposed();

            var error = NativeMethods.LossMulticlassLog_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));
            }
        }