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)); } }
internal LossDetails(LossMmod parent, IntPtr ptr) : base(false) { if (parent == null) { throw new ArgumentNullException(nameof(parent)); } parent.ThrowIfDisposed(); this._Parent = parent; this.NativePtr = ptr; }
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; }
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); }
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)); } }