Beispiel #1
0
        public static void SaveCheckpoint(string prefix,
                                          int?epoch,
                                          Symbol symbol,
                                          Dictionary <string, NdArray> argParams,
                                          Dictionary <string, NdArray> auxParams)
        {
            symbol.Save($"{prefix}-symbol.json");

            Dictionary <string, NdArray> dict = new Dictionary <string, NdArray>();

            foreach (var kv in argParams)
            {
                dict.Add($"arg:{kv.Key}", kv.Value);
            }
            foreach (var kv in auxParams)
            {
                dict.Add($"aux:{kv.Key}", kv.Value);
            }
            var paramName = $"{prefix}-{epoch:D4}.params";

            NdArray.Save(paramName, dict);
            ILog log = LogManager.GetLogger("");

            log.Info($"Saved checkpoint to \"{paramName}\"");
        }