def test(args):
    dset_loaders = digit_load(args)
    if (args.dset == 'u'):
        netF = network.LeNetBase()
    elif (args.dset == 'm'):
        netF = network.LeNetBase()
    elif (args.dset == 's'):
        netF = network.DTNBase()
    netB = network.feat_bootleneck(type=args.classifier, feature_dim=netF.in_features, bottleneck_dim=args.bottleneck)
    netC = network.feat_classifier(type=args.layer, class_num=args.class_num, bottleneck_dim=args.bottleneck)
    args.modelpath = (args.output_dir + '/F.pt')
    netF.load_state_dict(torch.load(args.modelpath))
    args.modelpath = (args.output_dir + '/B.pt')
    netB.load_state_dict(torch.load(args.modelpath))
    args.modelpath = (args.output_dir + '/C.pt')
    netC.load_state_dict(torch.load(args.modelpath))
    netF.eval()
    netB.eval()
    netC.eval()
    (acc, _) = cal_acc(dset_loaders['test'], netF, netB, netC)
    log_str = 'Task: {}, Accuracy = {:.2f}%'.format(args.dset, acc)
    try:
        args.out_file.write((log_str + '\n'))
        args.out_file.flush()
    except:
        pass
    print((log_str + '\n'))
def test(args):
    dset_loaders = digit_load(args)
    if (args.dset == 'u'):
        netF = network.LeNetBase()
    elif (args.dset == 'm'):
        netF = network.LeNetBase()
    elif (args.dset == 's'):
        netF = network.DTNBase()
    netB = network.feat_bootleneck(type=args.classifier, feature_dim=netF.in_features, bottleneck_dim=args.bottleneck)
    netC = network.feat_classifier(type=args.layer, class_num=args.class_num, bottleneck_dim=args.bottleneck)
    args.modelpath = (args.output_dir + '/F.pt')
    netF.load_state_dict(torch.load(args.modelpath))
    args.modelpath = (args.output_dir + '/B.pt')
    netB.load_state_dict(torch.load(args.modelpath))
    args.modelpath = (args.output_dir + '/C.pt')
    netC.load_state_dict(torch.load(args.modelpath))
    netF.eval()
    netB.eval()
    netC.eval()
    (acc, _) = cal_acc(dset_loaders['test'], netF, netB, netC)
    log_str = 'Task: {}, Accuracy = {:.2f}%'.format(args.dset, acc)
    try:
        args.out_file.write((log_str + '\n'))
        args.out_file.flush()
    except:
        pass
    print((log_str + '\n'))