# Path: options/options_test.py
# def add_general_arguments(parser):
# def parse(add_additional_arguments=None):
# 
# Path: util/util_print.py
# class bcolors:
#     HEADER = '\033[95m'
#     OKBLUE = '\033[94m'
#     OKGREEN = '\033[92m'
#     WARNING = '\033[93m'
#     FAIL = '\033[91m'
#     ENDC = '\033[0m'
#     BOLD = '\033[1m'
#     UNDERLINE = '\033[4m'
# 
# Path: loggers/loggers.py
# class BaseLogger(object):
# class _LogCumulator(BaseLogger):
# class ProgbarLogger(BaseLogger):
# class CsvLogger(BaseLogger):
# class BatchCsvLogger(BaseLogger):
# class ModelSaveLogger(BaseLogger):
# class TerminateOnNaN(BaseLogger):
# class TensorBoardLogger(BaseLogger):
# class HtmlLogger(BaseLogger):
# class ComposeLogger(BaseLogger):
#     def __init__(self):
#     def set_mute(self):
#     def on_train_begin(self):
#     def on_train_end(self):
#     def on_epoch_begin(self, epoch):
#     def on_epoch_end(self, epoch, epoch_log):
#     def on_batch_begin(self, batch):
#     def on_batch_end(self, batch, batch_log):
#     def set_params(self, params):
#     def set_model(self, model):
#     def train(self):
#     def eval(self):
#     def _set_unused_metric_mode(self, mode='none'):
#     def _allow_unused(self):
#     def __init__(self):
#     def on_epoch_begin(self, epoch):
#     def on_batch_end(self, batch, batch_log):
#     def get_epoch_log(self):
#     def __init__(self, count_mode='samples', allow_unused_fields='none', interval=10, no_accum=False):
#     def on_train_begin(self):
#     def on_epoch_begin(self, epoch):
#     def on_batch_begin(self, batch):
#     def on_batch_end(self, batch, batch_log):
#     def on_epoch_end(self, epoch, epoch_log):
#     def __init__(self, filename, allow_unused_fields='none'):
#     def on_train_begin(self):
#     def on_epoch_end(self, epoch, epoch_log):
#     def on_train_end(self):
#     def __init__(self, filename, allow_unused_fields='none'):
#     def on_train_begin(self):
#     def on_batch_end(self, batch, batch_log=None):
#     def on_train_end(self):
#     def __init__(self, filepath, period=1, save_optimizer=False, save_best=False, prev_best=None):
#     def on_train_begin(self):
#     def on_epoch_end(self, epoch, epoch_log):
#     def __init__(self):
#     def on_batch_begin(self, batch):
#     def on_batch_end(self, batch, batch_log):
#     def __init__(self, filepath, use_html_logger=False, allow_unused_fields='none'):
#     def on_train_begin(self):
#     def on_epoch_end(self, epoch, epoch_log):
#     def on_train_end(self):
#     def __init__(self, summary_filepath, allow_unused_fields='none'):
#     def on_train_begin(self):
#     def flush(self):
#     def on_epoch_begin(self, epoch):
#     def on_epoch_end(self, epoch, *args, **kargs):
#     def content_to_html(self):
#     def summary_to_html(self):
#     def __init__(self, loggers):
#     def get_tensorboard(self):
#     def get_html_logger(self):
#     def add_logger(self, logger):
#     def on_train_begin(self):
#     def on_train_end(self):
#     def on_epoch_begin(self, epoch):
#     def on_epoch_end(self, epoch, epoch_log):
#     def on_batch_begin(self, batch):
#     def on_batch_end(self, batch, batch_log):
#     def set_params(self, params):
#     def set_model(self, model):
#     def train(self):
#     def eval(self):


import os
import time
import torch
import datasets
import models
import util.util_loadlib as loadlib
from os.path import join
from shutil import rmtree
from tqdm import tqdm
from options import options_test
from util.util_print import str_error, str_stage, str_verbose
from loggers import loggers
from argparse import Namespace

###################################################

print(str_stage, "Parsing arguments")
opt = options_test.parse()
opt.full_logdir = None
print(opt)

###################################################

print(str_stage, "Setting device")
if opt.gpu == '-1':
    device = torch.device('cpu')
else:
    loadlib.set_gpu(opt.gpu)
    device = torch.device('cuda')
if opt.manual_seed is not None:
    loadlib.set_manual_seed(opt.manual_seed)

###################################################

print(str_stage, "Setting up output directory")
output_dir = opt.output_dir
output_dir += (opt.net + '_' + opt.dataset + '_' + opt.suffix.format(**vars(opt))) \
    if opt.suffix != '' else (opt.net + '_' + opt.dataset)
opt.output_dir = output_dir
if os.path.isdir(join(output_dir, 'epoch_%04d' % opt.epoch)):
    if opt.overwrite:
        rmtree(join(output_dir, 'epoch_%04d' % opt.epoch))
    else:

# Path: options/options_test.py
# def add_general_arguments(parser):
# def parse(add_additional_arguments=None):
# 
# Path: util/util_print.py
# class bcolors:
#     HEADER = '\033[95m'
#     OKBLUE = '\033[94m'
#     OKGREEN = '\033[92m'
#     WARNING = '\033[93m'
#     FAIL = '\033[91m'
#     ENDC = '\033[0m'
#     BOLD = '\033[1m'
#     UNDERLINE = '\033[4m'
# 
# Path: loggers/loggers.py
# class BaseLogger(object):
# class _LogCumulator(BaseLogger):
# class ProgbarLogger(BaseLogger):
# class CsvLogger(BaseLogger):
# class BatchCsvLogger(BaseLogger):
# class ModelSaveLogger(BaseLogger):
# class TerminateOnNaN(BaseLogger):
# class TensorBoardLogger(BaseLogger):
# class HtmlLogger(BaseLogger):
# class ComposeLogger(BaseLogger):
#     def __init__(self):
#     def set_mute(self):
#     def on_train_begin(self):
#     def on_train_end(self):
#     def on_epoch_begin(self, epoch):
#     def on_epoch_end(self, epoch, epoch_log):
#     def on_batch_begin(self, batch):
#     def on_batch_end(self, batch, batch_log):
#     def set_params(self, params):
#     def set_model(self, model):
#     def train(self):
#     def eval(self):
#     def _set_unused_metric_mode(self, mode='none'):
#     def _allow_unused(self):
#     def __init__(self):
#     def on_epoch_begin(self, epoch):
#     def on_batch_end(self, batch, batch_log):
#     def get_epoch_log(self):
#     def __init__(self, count_mode='samples', allow_unused_fields='none', interval=10, no_accum=False):
#     def on_train_begin(self):
#     def on_epoch_begin(self, epoch):
#     def on_batch_begin(self, batch):
#     def on_batch_end(self, batch, batch_log):
#     def on_epoch_end(self, epoch, epoch_log):
#     def __init__(self, filename, allow_unused_fields='none'):
#     def on_train_begin(self):
#     def on_epoch_end(self, epoch, epoch_log):
#     def on_train_end(self):
#     def __init__(self, filename, allow_unused_fields='none'):
#     def on_train_begin(self):
#     def on_batch_end(self, batch, batch_log=None):
#     def on_train_end(self):
#     def __init__(self, filepath, period=1, save_optimizer=False, save_best=False, prev_best=None):
#     def on_train_begin(self):
#     def on_epoch_end(self, epoch, epoch_log):
#     def __init__(self):
#     def on_batch_begin(self, batch):
#     def on_batch_end(self, batch, batch_log):
#     def __init__(self, filepath, use_html_logger=False, allow_unused_fields='none'):
#     def on_train_begin(self):
#     def on_epoch_end(self, epoch, epoch_log):
#     def on_train_end(self):
#     def __init__(self, summary_filepath, allow_unused_fields='none'):
#     def on_train_begin(self):
#     def flush(self):
#     def on_epoch_begin(self, epoch):
#     def on_epoch_end(self, epoch, *args, **kargs):
#     def content_to_html(self):
#     def summary_to_html(self):
#     def __init__(self, loggers):
#     def get_tensorboard(self):
#     def get_html_logger(self):
#     def add_logger(self, logger):
#     def on_train_begin(self):
#     def on_train_end(self):
#     def on_epoch_begin(self, epoch):
#     def on_epoch_end(self, epoch, epoch_log):
#     def on_batch_begin(self, batch):
#     def on_batch_end(self, batch, batch_log):
#     def set_params(self, params):
#     def set_model(self, model):
#     def train(self):
#     def eval(self):


# Path: test.py
import os
import time
import torch
import datasets
import models
import util.util_loadlib as loadlib
from os.path import join
from shutil import rmtree
from tqdm import tqdm
from options import options_test
from util.util_print import str_error, str_stage, str_verbose
from loggers import loggers
from argparse import Namespace


###################################################

print(str_stage, "Parsing arguments")
opt = options_test.parse()
opt.full_logdir = None
print(opt)

###################################################

print(str_stage, "Setting device")
if opt.gpu == '-1':
    device = torch.device('cpu')
else:
    loadlib.set_gpu(opt.gpu)
    device = torch.device('cuda')
if opt.manual_seed is not None:
    loadlib.set_manual_seed(opt.manual_seed)

###################################################

print(str_stage, "Setting up output directory")
output_dir = opt.output_dir
output_dir += (opt.net + '_' + opt.dataset + '_' + opt.suffix.format(**vars(opt))) \
    if opt.suffix != '' else (opt.net + '_' + opt.dataset)
opt.output_dir = output_dir
if os.path.isdir(join(output_dir, 'epoch_%04d' % opt.epoch)):
    if opt.overwrite:
        rmtree(join(output_dir, 'epoch_%04d' % opt.epoch))
    else:

        raise ValueError(str_error + " %s already exists, but no overwrite flag"