# Path: selfsup/util.py
# class DummyDict(object):
#     def __init__(self):
#         pass
#     def __getitem__(self, item):
#         return DummyDict()
#     def __setitem__(self, item, value):
#         return DummyDict()
#     def get(self, item, default=None):
#         if default is None:
#             return DummyDict()
#         else:
#             return default
# 
# Path: selfsup/util.py
# def tprint(*args, **kwargs):
#     global _tlog_path
#     import datetime
#     GRAY = '\033[1;30m'
#     RESET = '\033[0m'
#     time_str = GRAY+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+RESET
#     print(*((time_str,) + args), **kwargs) 
# 
#     if _tlog_path is not None:
#         with open(_tlog_path, 'a') as f:
#             nocol_time_str = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
#             print(*((nocol_time_str,) + args), file=f, **kwargs) 


from .util import DummyDict
from .util import tprint
import deepdish as dd
import numpy as np
    import tensorflow as tf
    import tensorflow as tf
        if conv_fc_transitionals is not None and name in conv_fc_transitionals:
            cf_shape = conv_fc_transitionals[name]
            tf_shape = (cf_shape[2], cf_shape[3], cf_shape[1], cf_shape[0])
            cfW = tfW.reshape(tf_shape).transpose(3, 2, 0, 1).reshape(cf_shape[0], -1)
            info[name] = 'fc->c transitioned with caffe shape {}'.format(cf_shape)
            return cfW
        else:
            return tfW.T


def from_caffe(cfW, name=None, color_layer='', conv_fc_transitionals=None, info=DummyDict()):
    assert conv_fc_transitionals is None or name is not None
    if cfW.ndim == 4:
        tfW = cfW.transpose(2, 3, 1, 0)
        assert conv_fc_transitionals is None or name is not None
        if (name == 'conv1_1' or name == 'conv1' or name == color_layer) and tfW.shape[2] == 3:
            tfW = tfW[:, :, ::-1]
            info[name] = 'flipped'
        return tfW
    else:
        if conv_fc_transitionals is not None and name in conv_fc_transitionals:
            cf_shape = conv_fc_transitionals[name]
            tfW = cfW.reshape(cf_shape).transpose(2, 3, 1, 0).reshape(-1, cf_shape[0])
            info[name] = 'c->fc transitioned with caffe shape {}'.format(cf_shape)
            return tfW
        else:
            return cfW.T


def load_caffemodel(path, session, prefix='', ignore=set(),

# Path: selfsup/util.py
# class DummyDict(object):
#     def __init__(self):
#         pass
#     def __getitem__(self, item):
#         return DummyDict()
#     def __setitem__(self, item, value):
#         return DummyDict()
#     def get(self, item, default=None):
#         if default is None:
#             return DummyDict()
#         else:
#             return default
# 
# Path: selfsup/util.py
# def tprint(*args, **kwargs):
#     global _tlog_path
#     import datetime
#     GRAY = '\033[1;30m'
#     RESET = '\033[0m'
#     time_str = GRAY+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+RESET
#     print(*((time_str,) + args), **kwargs) 
# 
#     if _tlog_path is not None:
#         with open(_tlog_path, 'a') as f:
#             nocol_time_str = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
#             print(*((nocol_time_str,) + args), file=f, **kwargs) 


# Path: selfsup/caffe.py
from .util import DummyDict
from .util import tprint
import deepdish as dd
import numpy as np
    import tensorflow as tf
    import tensorflow as tf

        if conv_fc_transitionals is not None and name in conv_fc_transitionals:
            cf_shape = conv_fc_transitionals[name]
            tf_shape = (cf_shape[2], cf_shape[3], cf_shape[1], cf_shape[0])
            cfW = tfW.reshape(tf_shape).transpose(3, 2, 0, 1).reshape(cf_shape[0], -1)
            info[name] = 'fc->c transitioned with caffe shape {}'.format(cf_shape)
            return cfW
        else:
            return tfW.T


def from_caffe(cfW, name=None, color_layer='', conv_fc_transitionals=None, info=DummyDict()):
    assert conv_fc_transitionals is None or name is not None
    if cfW.ndim == 4:
        tfW = cfW.transpose(2, 3, 1, 0)
        assert conv_fc_transitionals is None or name is not None
        if (name == 'conv1_1' or name == 'conv1' or name == color_layer) and tfW.shape[2] == 3:
            tfW = tfW[:, :, ::-1]
            info[name] = 'flipped'
        return tfW
    else:
        if conv_fc_transitionals is not None and name in conv_fc_transitionals:
            cf_shape = conv_fc_transitionals[name]
            tfW = cfW.reshape(cf_shape).transpose(2, 3, 1, 0).reshape(-1, cf_shape[0])
            info[name] = 'c->fc transitioned with caffe shape {}'.format(cf_shape)
            return tfW
        else:
            return cfW.T


def load_caffemodel(path, session, prefix='', ignore=set(),

                    conv_fc_transitionals=None, renamed_layers=DummyDict(),