From bf9b9331844def37565e09fcde638eedcfee3f0f Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 27 Jun 2024 10:35:02 +0800 Subject: [PATCH 1/2] update comfig.py --- npu_mnist_example/config.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/npu_mnist_example/config.py b/npu_mnist_example/config.py index a419659..3a90c7e 100644 --- a/npu_mnist_example/config.py +++ b/npu_mnist_example/config.py @@ -16,19 +16,21 @@ network config setting, will be used in train.py """ import os -os.system('pip install easydict') -from easydict import EasyDict as edict +class Config: + def __init__(self, **entries): + self.__dict__.update(entries) -mnist_cfg = edict({ - 'num_classes': 10, - 'lr': 0.01, - 'momentum': 0.9, - 'epoch_size': 10, - 'batch_size': 32, - 'buffer_size': 1000, - 'image_height': 32, - 'image_width': 32, - 'save_checkpoint_steps': 1875, - 'keep_checkpoint_max': 150, - 'air_name': "lenet", -}) +# 定义配置信息 +mnist_cfg = Config( + num_classes=10, + lr=0.01, + momentum=0.9, + epoch_size=10, + batch_size=32, + buffer_size=1000, + image_height=32, + image_width=32, + save_checkpoint_steps=1875, + keep_checkpoint_max=150, + air_name="lenet" +) From 5956c28134c73f338e779a9035e4d47b9ce306f7 Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 27 Jun 2024 10:38:36 +0800 Subject: [PATCH 2/2] update config.py --- npu_mnist_example/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/npu_mnist_example/config.py b/npu_mnist_example/config.py index 3a90c7e..70de3c1 100644 --- a/npu_mnist_example/config.py +++ b/npu_mnist_example/config.py @@ -20,6 +20,9 @@ class Config: def __init__(self, **entries): self.__dict__.update(entries) + def __getitem__(self, item): + return self.__dict__[item] + # 定义配置信息 mnist_cfg = Config( num_classes=10,