# Path: selfsup/multi/methods/base.py
# class Method:
#     def __init__(self, name, batch_size):
#         self.name = name
#         self.batch_size = batch_size
# 
#     def input_size(self):
#         return 0
# 
#     def batch_loader(self):
#         raise NotImplemented("Abstract base class")
# 
#     def build_network(network, y, phase_test):
#         raise NotImplemented("Abstract base class")
# 
#     @property
#     def basenet_settings():
#         return {}
# 
#     def make_path(self, name, ext, iteration):
#         return f'img/{self.name}_{name}_{iteration}.png'


import tensorflow as tf
import selfsup
import os
import functools
import numpy as np
from .base import Method
from autocolorize.tensorflow.sparse_extractor import sparse_extractor
from autocolorize.extraction import calc_rgb_from_hue_chroma
from collections import OrderedDict

def kl_divergence(labels, logits):
    #return tf.contrib.distributions.kl(p, q)
    return (tf.nn.softmax_cross_entropy_with_logits(labels=labels, logits=logits) -
            tf.nn.softmax_cross_entropy_with_logits(labels=labels, logits=tf.log(labels+1e-5)))



# Path: selfsup/multi/methods/base.py
# class Method:
#     def __init__(self, name, batch_size):
#         self.name = name
#         self.batch_size = batch_size
# 
#     def input_size(self):
#         return 0
# 
#     def batch_loader(self):
#         raise NotImplemented("Abstract base class")
# 
#     def build_network(network, y, phase_test):
#         raise NotImplemented("Abstract base class")
# 
#     @property
#     def basenet_settings():
#         return {}
# 
#     def make_path(self, name, ext, iteration):
#         return f'img/{self.name}_{name}_{iteration}.png'


# Path: selfsup/multi/methods/colorize_hypercolumn3.py
import tensorflow as tf
import selfsup
import os
import functools
import numpy as np
from .base import Method
from autocolorize.tensorflow.sparse_extractor import sparse_extractor
from autocolorize.extraction import calc_rgb_from_hue_chroma
from collections import OrderedDict


def kl_divergence(labels, logits):
    #return tf.contrib.distributions.kl(p, q)
    return (tf.nn.softmax_cross_entropy_with_logits(labels=labels, logits=logits) -
            tf.nn.softmax_cross_entropy_with_logits(labels=labels, logits=tf.log(labels+1e-5)))



class ColorizeHypercolumn3(Method):