コード例 #1
0
ファイル: BaseModel.cs プロジェクト: jacosoft/Keras.NET
        /// <summary>
        /// Retrieves the weights of the model
        /// </summary>
        /// <returns>A flat list of Numpy arrays</returns>
        public List <NDarray> GetWeights()
        {
            var            args      = new Dictionary <string, object>();
            var            pyWeights = PyInstance.get_weights();
            List <NDarray> weights   = new List <NDarray>();

            foreach (PyObject weightsArray in pyWeights)
            {
                var n = np.array(new NDarray(weightsArray));
                weights.Add(n);
            }

            return(weights);
        }
コード例 #2
0
ファイル: BaseModel.cs プロジェクト: zaojun/Keras.NET
 /// <summary>
 /// Summaries the specified line length.
 /// </summary>
 /// <param name="line_length">Length of the line.</param>
 /// <param name="positions">The positions.</param>
 public void Summary(int?line_length = null, float[] positions = null)
 {
     PyInstance.summary(line_length: line_length, positions: positions);
 }
コード例 #3
0
ファイル: BaseModel.cs プロジェクト: zaojun/Keras.NET
 /// <summary>
 /// Loads the weight to the model from a file.
 /// </summary>
 /// <param name="path">The path of of the weight file.</param>
 public void LoadWeight(string path)
 {
     PyInstance.load_weights(path);
 }
コード例 #4
0
ファイル: BaseModel.cs プロジェクト: zaojun/Keras.NET
 /// <summary>
 /// Save the model to h5 file
 /// </summary>
 /// <param name="path">The path with filename eg: model.h5.</param>
 public void Save(string filepath, bool overwrite = true, bool include_optimizer = true)
 {
     PyInstance.save(filepath: filepath, overwrite: overwrite, include_optimizer: include_optimizer);
 }
コード例 #5
0
ファイル: BaseModel.cs プロジェクト: zaojun/Keras.NET
 /// <summary>
 /// Saves the weight of the trained model to a file.
 /// </summary>
 /// <param name="path">The path of the weight to save.</param>
 public void SaveWeight(string path)
 {
     PyInstance.save_weights(path);
 }
コード例 #6
0
ファイル: BaseModel.cs プロジェクト: zaojun/Keras.NET
 /// <summary>
 /// Converts the model to json.
 /// </summary>
 /// <returns></returns>
 public string ToJson()
 {
     return(PyInstance.to_json().ToString());
 }
コード例 #7
0
ファイル: BaseModel.cs プロジェクト: jacosoft/Keras.NET
 /// <summary>
 /// Save the model to h5 file
 /// </summary>
 /// <param name="path">The path with filename eg: model.h5.</param>
 public void Save(string path)
 {
     PyInstance.save(path);
 }
コード例 #8
0
ファイル: Sequential.cs プロジェクト: zhamppx97/Keras.NET
 /// <summary>
 /// You can also simply add layers via the .Add() method
 /// </summary>
 /// <param name="layer">The layer.</param>
 public void Add(BaseLayer layer)
 {
     PyInstance.add(layer: layer.PyInstance);
 }