/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static ScalarParameter FromProto(RawProto rp) { string strVal; ScalarParameter p = new ScalarParameter(); if ((strVal = rp.FindValue("value")) != null) { p.value = double.Parse(strVal); } if ((strVal = rp.FindValue("operation")) != null) { if (strVal == ScalarOp.MUL.ToString()) { p.m_op = ScalarOp.MUL; } else if (strVal == ScalarOp.ADD.ToString()) { p.m_op = ScalarOp.ADD; } else { throw new Exception("Unknown scalar operation '" + strVal + "'"); } } if ((strVal = rp.FindValue("passthrough_gradient")) != null) { p.passthrough_gradient = bool.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static AttentionParameter FromProto(RawProto rp) { string strVal; AttentionParameter p = new AttentionParameter(); if ((strVal = rp.FindValue("axis")) != null) { p.axis = int.Parse(strVal); } if ((strVal = rp.FindValue("dim")) != null) { p.dim = uint.Parse(strVal); } RawProto rpWeightFiller = rp.FindChild("weight_filler"); if (rpWeightFiller != null) { p.weight_filler = FillerParameter.FromProto(rpWeightFiller); } RawProto rpBiasFiller = rp.FindChild("bias_filler"); if (rpBiasFiller != null) { p.bias_filler = FillerParameter.FromProto(rpBiasFiller); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static new NonMaximumSuppressionParameter FromProto(RawProto rp) { NonMaximumSuppressionParameter p = new NonMaximumSuppressionParameter(false); string strVal; RawProto rpOption = rp.FindChild("option"); if (rpOption != null) { ((OptionalParameter)p).Copy(OptionalParameter.FromProto(rpOption)); } if ((strVal = rp.FindValue("nms_threshold")) != null) { p.nms_threshold = float.Parse(strVal); } if ((strVal = rp.FindValue("top_k")) != null) { p.top_k = int.Parse(strVal); } if ((strVal = rp.FindValue("eta")) != null) { p.eta = float.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <param name="p">Optionally, specifies an instance to load. If <i>null</i>, a new instance is created and loaded.</param> /// <returns>A new instance of the parameter is returned.</returns> public static DataNoiseParameter FromProto(RawProto rp, DataNoiseParameter p = null) { string strVal; if (p == null) { p = new DataNoiseParameter(); } if ((strVal = rp.FindValue("use_noisy_mean")) != null) { p.use_noisy_mean = bool.Parse(strVal); } if ((strVal = rp.FindValue("noise_data_label")) != null) { p.noise_data_label = int.Parse(strVal); } if ((strVal = rp.FindValue("noisy_data_path")) != null) { p.noisy_save_path_persist = strVal; } RawProto rpNoiseFiller = rp.FindChild("noise_filler"); if (rpNoiseFiller != null) { p.noise_filler = FillerParameter.FromProto(rpNoiseFiller); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static new SaltPepperParameter FromProto(RawProto rp) { SaltPepperParameter p = new SaltPepperParameter(false); string strVal; RawProto rpOption = rp.FindChild("option"); if (rpOption != null) { ((OptionalParameter)p).Copy(OptionalParameter.FromProto(rpOption)); } if ((strVal = rp.FindValue("fraction")) != null) { p.fraction = float.Parse(strVal); } p.value = new List <float>(); RawProtoCollection col = rp.FindChildren("value"); foreach (RawProto rp1 in col) { if ((strVal = rp.FindValue("value")) != null) { p.value.Add(float.Parse(strVal)); } } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static ArgMaxParameter FromProto(RawProto rp) { string strVal; ArgMaxParameter p = new ArgMaxParameter(); if ((strVal = rp.FindValue("out_max_val")) != null) { p.out_max_val = bool.Parse(strVal); } if ((strVal = rp.FindValue("top_k")) != null) { p.top_k = uint.Parse(strVal); } if ((strVal = rp.FindValue("axis")) != null) { p.axis = int.Parse(strVal); } if ((strVal = rp.FindValue("operation")) != null) { if (strVal == COMPARE_OPERATOR.MIN.ToString()) { p.operation = COMPARE_OPERATOR.MIN; } else { p.operation = COMPARE_OPERATOR.MAX; } } return(p); }
/// <summary> /// Parses a RawProto representing a NetState into a NetState instance. /// </summary> /// <param name="rp">Specifies the RawProto representing the NetState.</param> /// <returns>The new instance of the NetState is returned.</returns> public static NetState FromProto(RawProto rp) { string strVal; NetState p = new NetState(); if ((strVal = rp.FindValue("phase")) != null) { switch (strVal) { case "TEST": p.phase = Phase.TEST; break; case "TRAIN": p.phase = Phase.TRAIN; break; case "NONE": p.phase = Phase.NONE; break; default: throw new Exception("Unknown 'phase' value: " + strVal); } } if ((strVal = rp.FindValue("level")) != null) { p.level = int.Parse(strVal); } p.stage = rp.FindArray <string>("stage"); return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static new PoolingParameter FromProto(RawProto rp) { string strVal; PoolingParameter p = new PoolingParameter(); ((KernelParameter)p).Copy(KernelParameter.FromProto(rp)); if ((strVal = rp.FindValue("pool")) != null) { switch (strVal) { case "MAX": p.pool = PoolingMethod.MAX; break; case "AVE": p.pool = PoolingMethod.AVE; break; case "STOCHASTIC": p.pool = PoolingMethod.STOCHASTIC; break; default: throw new Exception("Unknown pooling 'method' value: " + strVal); } } if ((strVal = rp.FindValue("global_pooling")) != null) { p.global_pooling = bool.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static new MaskParameter FromProto(RawProto rp) { MaskParameter p = new MaskParameter(true); string strVal; RawProto rpOption = rp.FindChild("option"); if (rpOption != null) { ((OptionalParameter)p).Copy(OptionalParameter.FromProto(rpOption)); } if ((strVal = rp.FindValue("boundary_left")) != null) { p.boundary_left = int.Parse(strVal); } if ((strVal = rp.FindValue("boundary_right")) != null) { p.boundary_right = int.Parse(strVal); } if ((strVal = rp.FindValue("boundary_top")) != null) { p.boundary_top = int.Parse(strVal); } if ((strVal = rp.FindValue("boundary_bottom")) != null) { p.boundary_bottom = int.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static EmitConstraint FromProto(RawProto rp) { EmitConstraint p = new EmitConstraint(); string strVal; if ((strVal = rp.FindValue("emit_type")) != null) { switch (strVal) { case "CENTER": p.emit_type = EmitType.CENTER; break; case "MIN_OVERLAP": p.emit_type = EmitType.MIN_OVERLAP; break; default: throw new Exception("Unknown emit_type '" + strVal + "'!"); } } if ((strVal = rp.FindValue("emit_overlap")) != null) { p.emit_overlap = float.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static MemoryDataParameter FromProto(RawProto rp) { string strVal; MemoryDataParameter p = new MemoryDataParameter(); if ((strVal = rp.FindValue("batch_size")) != null) { p.m_nBatchSize = uint.Parse(strVal); } if ((strVal = rp.FindValue("channels")) != null) { p.channels = uint.Parse(strVal); } if ((strVal = rp.FindValue("height")) != null) { p.height = uint.Parse(strVal); } if ((strVal = rp.FindValue("width")) != null) { p.width = uint.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static new SPPParameter FromProto(RawProto rp) { string strVal; SPPParameter p = new SPPParameter(); p.Copy(EngineParameter.FromProto(rp)); if ((strVal = rp.FindValue("method")) != null) { switch (strVal) { case "MAX": p.pool = PoolingParameter.PoolingMethod.MAX; break; case "AVE": p.pool = PoolingParameter.PoolingMethod.AVE; break; case "STOCHASTIC": p.pool = PoolingParameter.PoolingMethod.STOCHASTIC; break; default: throw new Exception("Unknown pooling 'method' value: " + strVal); } } if ((strVal = rp.FindValue("pyramid_height")) != null) { p.pyramid_height = uint.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <param name="p">Optionally, specifies an instance to load. If <i>null</i>, a new instance is created and loaded.</param> /// <returns>A new instance of the parameter is returned.</returns> public static ModelDataParameter FromProto(RawProto rp, ModelDataParameter p = null) { string strVal; if (p == null) { p = new ModelDataParameter(); } p.source = rp.FindArray <string>("source"); if ((strVal = rp.FindValue("batch_size")) != null) { p.batch_size = uint.Parse(strVal); } if ((strVal = rp.FindValue("time_steps")) != null) { p.time_steps = uint.Parse(strVal); } if ((strVal = rp.FindValue("input_dim")) != null) { p.input_dim = uint.Parse(strVal); } if ((strVal = rp.FindValue("shuffle")) != null) { p.shuffle = bool.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static LabelMappingParameter FromProto(RawProto rp) { LabelMappingParameter p = new LabelMappingParameter(); p.m_rgMapping = LabelMappingCollection.Parse(rp.FindArray <string>("mapping")); string strUpdateDb = rp.FindValue("update_database"); if (strUpdateDb != null && strUpdateDb.ToLower() == "true") { p.m_bUpdateDatabase = true; } string strReset = rp.FindValue("reset_database_labels"); if (strReset != null && strReset.ToLower() == "true") { p.m_bResetDatabaseLabels = true; } p.m_strLabelBoosts = rp.FindValue("label_boosts"); if (p.m_strLabelBoosts == null) { p.m_strLabelBoosts = ""; } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static ReinforcementLossParameter FromProto(RawProto rp) { string strVal; ReinforcementLossParameter p = new ReinforcementLossParameter(); if ((strVal = rp.FindValue("discount_rate")) != null) { p.discount_rate = double.Parse(strVal); } if ((strVal = rp.FindValue("exploration_rate_start")) != null) { p.exploration_rate_start = double.Parse(strVal); } if ((strVal = rp.FindValue("exploration_rate_end")) != null) { p.exploration_rate_end = double.Parse(strVal); } if ((strVal = rp.FindValue("exploration_rate_decay")) != null) { p.exploration_rate_decay = double.Parse(strVal); } if ((strVal = rp.FindValue("training_step")) != null) { p.training_step = uint.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static MeanErrorLossParameter FromProto(RawProto rp) { string strVal; MeanErrorLossParameter p = new MeanErrorLossParameter(); if ((strVal = rp.FindValue("axis")) != null) { p.axis = int.Parse(strVal); } if ((strVal = rp.FindValue("mean_error_type")) != null) { switch (strVal) { case "MSE": p.mean_error_type = MEAN_ERROR.MSE; break; case "MAE": p.mean_error_type = MEAN_ERROR.MAE; break; default: throw new Exception("The mean _error_type parameter must be one of the following: MSE, MAE"); } } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static OneHotParameter FromProto(RawProto rp) { string strVal; OneHotParameter p = new OneHotParameter(); if ((strVal = rp.FindValue("axis")) != null) { p.axis = int.Parse(strVal); } if ((strVal = rp.FindValue("num_output")) != null) { p.num_output = uint.Parse(strVal); } if ((strVal = rp.FindValue("min")) != null) { p.min = double.Parse(strVal); } if ((strVal = rp.FindValue("max")) != null) { p.max = double.Parse(strVal); } if ((strVal = rp.FindValue("min_axes")) != null) { p.min_axes = int.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <param name="p">Optionally, specifies an instance to load. If <i>null</i>, a new instance is created and loaded.</param> /// <returns>A new instance of the parameter is returned.</returns> public static HDF5DataParameter FromProto(RawProto rp, HDF5DataParameter p = null) { string strVal; if (p == null) p = new HDF5DataParameter(); if ((strVal = rp.FindValue("source")) != null) p.source = strVal.Trim('\"'); if ((strVal = rp.FindValue("batch_size")) != null) p.batch_size = uint.Parse(strVal); if ((strVal = rp.FindValue("shuffle")) != null) p.shuffle = bool.Parse(strVal); p.m_rgExpectedTopShapes = new List<BlobShape>(); RawProtoCollection colExpectedTopShapes = rp.FindChildren("expected_top_shape"); foreach (RawProto rp1 in colExpectedTopShapes) { p.m_rgExpectedTopShapes.Add(BlobShape.FromProto(rp1)); } return p; }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static GramParameter FromProto(RawProto rp) { string strVal; GramParameter p = new GramParameter(); if ((strVal = rp.FindValue("axis")) != null) { p.axis = int.Parse(strVal); } if ((strVal = rp.FindValue("alpha")) != null) { p.alpha = ParseDouble(strVal); } if ((strVal = rp.FindValue("beta")) != null) { p.beta = ParseDouble(strVal); } if ((strVal = rp.FindValue("disable_scaling_on_gradient")) != null) { p.disable_scaling_on_gradient = bool.Parse(strVal); } return(p); }
/// <summary> /// Parse a new Sample from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto containing a representation of the Sample.</param> /// <returns>A new instance of the Sample is returned.</returns> public static Sampler FromProto(RawProto rp) { string strVal; Sampler p = new Sampler(); if ((strVal = rp.FindValue("min_scale")) != null) { p.min_scale = float.Parse(strVal); } if ((strVal = rp.FindValue("max_scale")) != null) { p.max_scale = float.Parse(strVal); } if ((strVal = rp.FindValue("min_aspect_ratio")) != null) { p.min_aspect_ratio = float.Parse(strVal); } if ((strVal = rp.FindValue("max_aspect_ratio")) != null) { p.max_aspect_ratio = float.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static Normalization2Parameter FromProto(RawProto rp) { string strVal; Normalization2Parameter p = new Normalization2Parameter(); if ((strVal = rp.FindValue("across_spatial")) != null) { p.across_spatial = bool.Parse(strVal); } if ((strVal = rp.FindValue("channel_shared")) != null) { p.channel_shared = bool.Parse(strVal); } if ((strVal = rp.FindValue("eps")) != null) { p.eps = ParseFloat(strVal); } RawProto rgScaleFiller = rp.FindChild("scale_filler"); if (rgScaleFiller != null) { p.scale_filler = FillerParameter.FromProto(rgScaleFiller); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static GradientScaleParameter FromProto(RawProto rp) { string strVal; GradientScaleParameter p = new GradientScaleParameter(); if ((strVal = rp.FindValue("lower_bound")) != null) { p.lower_bound = double.Parse(strVal); } if ((strVal = rp.FindValue("upper_bound")) != null) { p.upper_bound = double.Parse(strVal); } if ((strVal = rp.FindValue("alpha")) != null) { p.alpha = double.Parse(strVal); } if ((strVal = rp.FindValue("max_iter")) != null) { p.max_iter = double.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static new UnPoolingParameter FromProto(RawProto rp) { UnPoolingParameter p = new UnPoolingParameter(); ((PoolingParameter)p).Copy(PoolingParameter.FromProto(rp)); p.m_rgUnpool = rp.FindArray <uint>("unpool_size"); p.m_nUnPoolH = (uint?)rp.FindValue("unpool_h", typeof(uint)); p.m_nUnPoolW = (uint?)rp.FindValue("unpool_w", typeof(uint)); return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static EltwiseParameter FromProto(RawProto rp) { string strVal; EltwiseParameter p = new EltwiseParameter(); if ((strVal = rp.FindValue("operation")) != null) { switch (strVal) { case "PROD": p.operation = EltwiseOp.PROD; break; case "SUM": p.operation = EltwiseOp.SUM; break; case "MAX": p.operation = EltwiseOp.MAX; break; case "MIN": p.operation = EltwiseOp.MIN; break; case "DIV": p.operation = EltwiseOp.DIV; break; case "SUB": p.operation = EltwiseOp.SUB; break; default: throw new Exception("Unknown 'operation' value: " + strVal); } } p.coeff = rp.FindArray <double>("coeff"); if ((strVal = rp.FindValue("stable_prod_grad")) != null) { p.stable_prod_grad = bool.Parse(strVal); } if ((strVal = rp.FindValue("coeff_blob")) != null) { p.coeff_blob = bool.Parse(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static TileParameter FromProto(RawProto rp) { string strVal; TileParameter p = new TileParameter(); if ((strVal = rp.FindValue("axis")) != null) p.axis = int.Parse(strVal); if ((strVal = rp.FindValue("tiles")) != null) p.tiles = int.Parse(strVal); return p; }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static ReductionParameter FromProto(RawProto rp) { string strVal; ReductionParameter p = new ReductionParameter(); if ((strVal = rp.FindValue("operation")) != null) { switch (strVal) { case "ASUM": p.operation = ReductionOp.ASUM; break; case "MEAN": p.operation = ReductionOp.MEAN; break; case "SUM": p.operation = ReductionOp.SUM; break; case "SUMSQ": p.operation = ReductionOp.SUMSQ; break; case "MIN": p.operation = ReductionOp.MIN; break; case "MAX": p.operation = ReductionOp.MAX; break; default: throw new Exception("Uknown 'operation' value: " + strVal); } } if ((strVal = rp.FindValue("axis")) != null) { p.axis = int.Parse(strVal); } if ((strVal = rp.FindValue("coeff")) != null) { p.coeff = ParseDouble(strVal); } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static EngineParameter FromProto(RawProto rp) { string strVal; EngineParameter p = new EngineParameter(); if ((strVal = rp.FindValue("engine")) != null) { switch (strVal) { case "DEFAULT": p.engine = Engine.DEFAULT; break; case "CAFFE": p.engine = Engine.CAFFE; break; case "CUDNN": p.engine = Engine.CUDNN; break; default: throw new Exception("Unknown 'engine' value: " + strVal); } } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static MathParameter FromProto(RawProto rp) { string strVal; MathParameter p = new MathParameter(); if ((strVal = rp.FindValue("function")) != null) { if (strVal == MyCaffe.common.MATH_FUNCTION.COS.ToString()) { p.function = MyCaffe.common.MATH_FUNCTION.COS; } else if (strVal == MyCaffe.common.MATH_FUNCTION.SIN.ToString()) { p.function = MyCaffe.common.MATH_FUNCTION.SIN; } else if (strVal == MyCaffe.common.MATH_FUNCTION.TAN.ToString()) { p.function = MyCaffe.common.MATH_FUNCTION.TAN; } else { p.function = MyCaffe.common.MATH_FUNCTION.NOP; } } return(p); }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static DistortionParameter FromProto(RawProto rp) { DistortionParameter p = new DistortionParameter(); string strVal; if ((strVal = rp.FindValue("brightness_prob")) != null) { p.brightness_prob = float.Parse(strVal); } if ((strVal = rp.FindValue("brightness_delta")) != null) { p.brightness_delta = float.Parse(strVal); } if ((strVal = rp.FindValue("contrast_prob")) != null) { p.contrast_prob = float.Parse(strVal); } if ((strVal = rp.FindValue("contrast_lower")) != null) { p.contrast_lower = float.Parse(strVal); } if ((strVal = rp.FindValue("contrast_upper")) != null) { p.contrast_upper = float.Parse(strVal); } if ((strVal = rp.FindValue("saturation_prob")) != null) { p.saturation_prob = float.Parse(strVal); } if ((strVal = rp.FindValue("saturation_lower")) != null) { p.saturation_lower = float.Parse(strVal); } if ((strVal = rp.FindValue("saturation_upper")) != null) { p.saturation_upper = float.Parse(strVal); } if ((strVal = rp.FindValue("random_order_prob")) != null) { p.random_order_prob = float.Parse(strVal); } return(p); }
/// <summary> /// Parse a RawProto into a new instance of the parameter. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <returns>A new instance of the parameter is returned.</returns> public static NetParameter FromProto(RawProto rp) { string strVal; NetParameter p = new NetParameter(); if ((strVal = rp.FindValue("name")) != null) { p.name = strVal; } p.input = rp.FindArray <string>("input"); RawProtoCollection rgp = rp.FindChildren("input_shape"); foreach (RawProto rpChild in rgp) { p.input_shape.Add(BlobShape.FromProto(rpChild)); } p.input_dim = rp.FindArray <int>("input_dim"); if ((strVal = rp.FindValue("force_backward")) != null) { p.force_backward = bool.Parse(strVal); } RawProto rpState = rp.FindChild("state"); if (rpState != null) { p.state = NetState.FromProto(rpState); } if ((strVal = rp.FindValue("debug_info")) != null) { p.debug_info = bool.Parse(strVal); } rgp = rp.FindChildren("layer", "layers"); foreach (RawProto rpChild in rgp) { p.layer.Add(LayerParameter.FromProto(rpChild)); } return(p); }