Esempio n. 1
0
args.inference = 1  # set to run inference simulation
# Hardware Properties
args.subArray = 128  # size of subArray (e.g. 128*128)
args.ADCprecision = 6  # ADC precision (e.g. 5-bit)
args.cellBit = 4  # cell precision (e.g. 4-bit/cell)
args.onoffratio = 10  # device on/off ratio (e.g. Gmax/Gmin = 3)
# if do not run the device retention / conductance variation effects, set args.vari=0, args.v=0
args.vari = 0  # conductance variation (e.g. 0.1 standard deviation to generate random variation)
args.t = 0  # retention time
args.v = 0  # drift coefficient
args.detect = 1  # if 1, fixed-direction drift, if 0, random drift
args.target = 0.5  # drift target for fixed-direction drift

args.logdir = os.path.join(os.path.dirname(__file__), args.logdir)
args = make_path.makepath(args, [
    'log_interval', 'test_interval', 'logdir', 'epochs', 'gpu', 'ngpu', 'debug'
])

misc.logger.init(args.logdir, 'test_log' + current_time)
logger = misc.logger.info

misc.ensure_dir(args.logdir)
logger("=================FLAGS==================")
for k, v in args.__dict__.items():
    logger('{}: {}'.format(k, v))
logger("========================================")

# seed
args.cuda = torch.cuda.is_available()
torch.manual_seed(args.seed)
if args.cuda:
Esempio n. 2
0
                    help='how many epochs to wait before another test')
parser.add_argument('--logdir',
                    default='log/default',
                    help='folder to save to the log')
parser.add_argument('--decreasing_lr',
                    default='200,250',
                    help='decreasing strategy')
parser.add_argument('--wl_weight', type=int, default=2)
parser.add_argument('--wl_grad', type=int, default=8)
parser.add_argument('--wl_activate', type=int, default=8)
parser.add_argument('--wl_error', type=int, default=8)
current_time = datetime.now().strftime('%Y_%m_%d_%H_%M_%S')

args = parser.parse_args()
args.logdir = os.path.join(os.path.dirname(__file__), args.logdir)
args = make_path.makepath(
    args, ['log_interval', 'test_interval', 'logdir', 'epochs'])
misc.logger.init(args.logdir, 'train_log_' + current_time)
logger = misc.logger.info

# logger
misc.ensure_dir(args.logdir)
logger("=================FLAGS==================")
for k, v in args.__dict__.items():
    logger('{}: {}'.format(k, v))
logger("========================================")

# seed
args.cuda = torch.cuda.is_available()
torch.manual_seed(args.seed)
if args.cuda:
    torch.cuda.manual_seed(args.seed)