for epoch in range(args.start_epoch, args.epochs):
adjust_learning_rate(optimizer, epoch)
prec1 = validate(val_loader, model, criterion, epoch)
// train for one epoch
train(train_loader, model, criterion, optimizer, epoch)
// evaluate on validation set
After Change
// define loss function (criterion) and optimizer
criterion = nn.CrossEntropyLoss().cuda()
param_grp_1 = []
for m in model.modules():
if isinstance(m,BinConv2d):
param_grp_1.append(m.weight)
param_grp_1.append(m.alpha)
param_grp_1.append(m.beta)
param_grp_1.append(m.gamma)
param_grp_1_ids = list(map(id, param_grp_1))
param_grp_2 = list(filter(lambda p: id(p) not in param_grp_1_ids, model.parameters()))
if args.optimizer == "sgd":
if args.quantize: