# Path: loggers/loggers.py
# class _LogCumulator(BaseLogger):
#     """ cumulate the batch_log and generate an epoch_log
#     Note that this logger is used for generating epoch_log,
#     and thus does not take epoch_log as input"""
# 
#     def __init__(self):
#         pass
# 
#     def on_epoch_begin(self, epoch):
#         self.log_values = defaultdict(list)
#         self.sizes = list()
#         self.epoch_log = None
# 
#     def on_batch_end(self, batch, batch_log):
#         for k, v in batch_log.items():
#             self.log_values[k].append(v)
#         self.sizes.append(batch_log['size'])
# 
#     def get_epoch_log(self):
#         epoch_log = dict()
#         for k in self.log_values:
#             epoch_log[k] = (np.array(self.log_values[k]) * np.array(self.sizes)).sum() / np.array(self.sizes).sum()
#         return epoch_log
# 
# 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'


import time
import torch.optim as optim
import torch
import torch.distributed as dist
from torch.nn import init
from torch import FloatTensor, tensor
from loggers.loggers import _LogCumulator
from util.util_print import str_warning
                    init.normal_(m.weight.data, 0.0, init_param)
                elif init_type == 'xavier':
                    init.xavier_normal_(m.weight.data, gain=init_param)
                elif init_type == 'kaiming':
                    init.kaiming_normal_(m.weight.data, a=a, mode='fan_in')
                elif init_type == 'orth':
                    init.orthogonal_(m.weight.data, gain=init_param)
                else:
                    raise NotImplementedError(
                        'initialization method [%s] is not implemented' % init_type)
                if hasattr(m, 'bias') and m.bias is not None:
                    init.constant_(m.bias.data, 0.0)
            elif classname.find('BatchNorm') != -1:
                if m.affine:
                    init.normal_(m.weight.data, 1.0, init_param)
                    init.constant_(m.bias.data, 0.0)
                if turnoff_tracking:
                    m.track_running_stats = False
        if net is not None:
            net.apply(init_func)
        else:
            self.net.apply(init_func)

    @classmethod
    def add_arguments(cls, parser):
        unique_params = set()
        return parser, unique_params

    def __init__(self, opt, logger):


# Path: loggers/loggers.py
# class _LogCumulator(BaseLogger):
#     """ cumulate the batch_log and generate an epoch_log
#     Note that this logger is used for generating epoch_log,
#     and thus does not take epoch_log as input"""
# 
#     def __init__(self):
#         pass
# 
#     def on_epoch_begin(self, epoch):
#         self.log_values = defaultdict(list)
#         self.sizes = list()
#         self.epoch_log = None
# 
#     def on_batch_end(self, batch, batch_log):
#         for k, v in batch_log.items():
#             self.log_values[k].append(v)
#         self.sizes.append(batch_log['size'])
# 
#     def get_epoch_log(self):
#         epoch_log = dict()
#         for k in self.log_values:
#             epoch_log[k] = (np.array(self.log_values[k]) * np.array(self.sizes)).sum() / np.array(self.sizes).sum()
#         return epoch_log
# 
# 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: models/netinterface.py
import time
import torch.optim as optim
import torch
import torch.distributed as dist
from torch.nn import init
from torch import FloatTensor, tensor
from loggers.loggers import _LogCumulator
from util.util_print import str_warning

                    init.normal_(m.weight.data, 0.0, init_param)
                elif init_type == 'xavier':
                    init.xavier_normal_(m.weight.data, gain=init_param)
                elif init_type == 'kaiming':
                    init.kaiming_normal_(m.weight.data, a=a, mode='fan_in')
                elif init_type == 'orth':
                    init.orthogonal_(m.weight.data, gain=init_param)
                else:
                    raise NotImplementedError(
                        'initialization method [%s] is not implemented' % init_type)
                if hasattr(m, 'bias') and m.bias is not None:
                    init.constant_(m.bias.data, 0.0)
            elif classname.find('BatchNorm') != -1:
                if m.affine:
                    init.normal_(m.weight.data, 1.0, init_param)
                    init.constant_(m.bias.data, 0.0)
                if turnoff_tracking:
                    m.track_running_stats = False
        if net is not None:
            net.apply(init_func)
        else:
            self.net.apply(init_func)

    @classmethod
    def add_arguments(cls, parser):
        unique_params = set()
        return parser, unique_params

    def __init__(self, opt, logger):


        self._internal_logger = _LogCumulator()