input = F.relu(torch.add(input, -minimum))
	input = F.relu(torch.add(torch.neg(input), maximum-minimum))
	input = torch.add(torch.neg(input), maximum)
	return input	

def quant(input):
	input = torch.round(input / (2 ** (-args.aprec))) * (2 ** (-args.aprec))
	return input

# Load checkpoint.
if args.mode == 0:
	print('==> Resuming from checkpoint..')
	assert os.path.isdir('checkpoint'), 'Error: no checkpoint directory found!'
	checkpoint = torch.load('./checkpoint/'+args.network)
	net = checkpoint['net']
	params = utils.paramsGet(net)
	tmp = (params.data != 0).sum()
	print(tmp.item()/params.size()[0])

elif args.mode == 1:
	checkpoint = torch.load('./checkpoint/ckpt_20190802_half_clean_B3.t0')
	ckpt = torch.load('./checkpoint/ckpt_20190802_half_clean_B2.t0')
	net = checkpoint['net']
	net2 = ckpt['net']
	if args.resume:
		print('==> Resuming from checkpoint..')
		best_acc = checkpoint['acc']
	else:
		best_acc = 0

elif args.mode == 2:
def evalMetric(net, net_origin):
    params_net = utils.paramsGet(net)
    params_net_origin = utils.paramsGet(net_origin)
    print(params_net.size())
    print(params_net_origin.size())