コード例 #1
0
        public CustomObjectScope(CustomObjects args)
        {
            this.custom_objects = args;
            this.backup         = null;

            this.backup = GenericUtils._GLOBAL_CUSTOM_OBJECTS.Copy();
            foreach (var objects in this.custom_objects)
            {
                GenericUtils._GLOBAL_CUSTOM_OBJECTS[objects.Key] = objects.Value;
            }
        }
コード例 #2
0
ファイル: Sequential.cs プロジェクト: quakemaster/MxNet.Sharp
        public static new Sequential FromConfig(ConfigDict config, CustomObjects custom_objects = null)
        {
            List <ConfigDict> layer_configs     = null;
            string            name              = "";
            Shape             build_input_shape = null;

            if (config.ContainsKey("name"))
            {
                name = config["name"].ToString();
                build_input_shape = config.ContainsKey("build_input_shape") ? (Shape)config["build_input_shape"] : null;
                layer_configs     = (List <ConfigDict>)config["layers"];
            }
            else
            {
                // legacy config file
                name          = null;
                layer_configs = new List <ConfigDict>()
                {
                    config
                };
            }

            var        t     = Type.GetType(name, true, true);
            Sequential model = (Sequential)Activator.CreateInstance(t);

            foreach (var conf in layer_configs)
            {
                var layer = Layer.FromConfig(conf.First().Key, (ConfigDict)conf.First().Value, custom_objects);
                model.Add(layer);
            }
            if (model.inputs == null && build_input_shape != null)
            {
                model.Build(build_input_shape);
            }

            return(model);
        }
コード例 #3
0
 /// <summary>
 /// Retrieves a custom object from the
 /// </summary>
 /// <param name="key">The key of the object in the dictionary</param>
 /// <returns>The object or null if the key was not found</returns>
 public object GetCustomObject(string key)
 {
     return(CustomObjects.ContainsKey(key) ? CustomObjects[key] : null);
 }
コード例 #4
0
ファイル: Lambda.cs プロジェクト: quakemaster/MxNet.Sharp
 public static new Layer FromConfig(string cls, ConfigDict config, CustomObjects custom_objects = null)
 {
     throw new NotImplementedException();
 }
コード例 #5
0
 public static Regularizer Deserialize(ConfigDict config, CustomObjects custom_objects = null)
 {
     return((Regularizer)Utils.GenericUtils.DeserializeKerasObject(config, custom_objects: custom_objects, printable_module_name: "regularizer"));
 }
コード例 #6
0
 public static object DeserializeKerasObject(object identifier, string module_objects = "", CustomObjects custom_objects = null, string printable_module_name = "object")
 {
     throw new NotImplementedException();
 }
コード例 #7
0
 public static CustomObjectScope CustomObjectScope(CustomObjects args)
 {
     return(new CustomObjectScope(args));
 }
コード例 #8
0
 public static Model ModelFromJson(string json_string, CustomObjects custom_objects = null)
 {
     throw new NotImplementedException();
 }
コード例 #9
0
 public static Model ModelFromConfig(ConfigDict config, CustomObjects custom_objects = null)
 {
     throw new NotImplementedException();
 }
コード例 #10
0
 public static Model LoadModel(string filepath, CustomObjects custom_objects = null, bool compile = true)
 {
     throw new NotImplementedException();
 }
コード例 #11
0
 private static Model DeserializeModel(H5Dict f, CustomObjects custom_objects = null, bool compile = true)
 {
     throw new NotImplementedException();
 }