//set parameter by name public void SetParam(string name, float[] data) { Debug.Assert(IsBuilt, "Network is not built yet while trying to set a parameter called: " + name); Parameter p = CNTKFunction.FindParameterByName(name); Debug.Assert(p != null, "Did not find parameter called: " + name); p.SetValue(new NDArrayView(p.Shape, data, p.Value().Device));//this will has error if the data size does not fit the parameter shape }
//get parameter by name public IList <float> GetParam(string name) { Debug.Assert(IsBuilt, "Network is not built yet while trying to get a parameter called: " + name); Parameter p = CNTKFunction.FindParameterByName(name); if (p == null) { return(null); } var v = new Value(p.Value()); return(v.GetDenseData <float>(p)[0]); }
public void Restore(byte[] data) { Function f = Function.Load(data, Device); CNTKFunction.RestoreParametersByName(f); }
public byte[] Save() { return(CNTKFunction.Save()); }