Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
 /// <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);
 }
Exemplo n.º 3
0
 /// <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);
 }
Exemplo n.º 4
0
 /// <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);
 }
Exemplo n.º 5
0
 /// <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);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Converts the model to json.
 /// </summary>
 /// <returns></returns>
 public string ToJson()
 {
     return(PyInstance.to_json().ToString());
 }
Exemplo n.º 7
0
 /// <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);
 }
Exemplo n.º 8
0
 /// <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);
 }