def Draw(): for net_name in ["p120", "r120", "d120", "d40", "r40"]: tb = TB(net_name + "_tbdata/") grad_lis = pickle.load(open(net_name + "_grad.data", "rb")) for i in grad_lis: tb.tick() tb.add_scalar("loged_grad", np.log(i)) tb.add_scalar("grad", i) tb.flush()
tb.add_scalar("loss", loss) tb.add_scalar("traing_acc", acc) print("Minibatch = {}, Loss = {}, Acc = {}".format(i, loss, acc)) #Learning Rate Adjusting if i == ORI_IT // 2 or i == ORI_IT // 4 * 3: optimizer.learning_rate /= 10 if i == ORI_IT: optimizer.learning_rate = 1e-5 if i % (EPOCH_NUM) == 0: epoch += 1 acc = C.test(valid_func) his_test.append([i, acc]) print("Epoch = {}, Acc = {}, Max_acc = {}".format(epoch, acc, max_acc)) b = time.time() b = b + (b - a) / i * (TOT_IT - i) print("Expected finish time {}".format(time.asctime(time.localtime(b)))) tb.add_scalar("test_acc", acc) if acc > max_acc and i > ORI_IT: max_acc = acc env.save_checkpoint(path + "{}.data".format(net_name)) print("**************************") import pickle with open("hisloss.data", "wb") as f: pickle.dump(his, f) with open("histest.data", "wb") as f: pickle.dump(his_test, f) tb.flush()