# 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
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
            loss_chr_each = tf.multiply(chr_weights, tf.nn.sparse_softmax_cross_entropy_with_logits(labels=y_chr, logits=z_chr))
            loss_hue_each = tf.multiply(5 * y_huechr[..., 1], tf.nn.sparse_softmax_cross_entropy_with_logits(labels=y_hue, logits=z_hue), name='foo')
            hue_loss = tf.reduce_mean(loss_hue_each)
            chr_loss = tf.reduce_mean(loss_chr_each)
            primary_loss = hue_loss + chr_loss

        l2_layers = [
            info['weights']['pre_h_fc1:weights'],
            info['weights']['hue:weights'],
            info['weights']['chroma:weights'],
        ]
        with tf.name_scope('weight_decay'):
            wd = 1e-6
            l2_loss = tf.add_n([
                tf.nn.l2_loss(v) for v in l2_layers
            ])
            weight_decay = wd * l2_loss

        with tf.name_scope('loss'):
            loss = weight_decay + primary_loss


        self._losses = OrderedDict([
            ('hue', hue_loss),
            ('chr', chr_loss),
            ('+weight_decay', weight_decay),
        ])
        self._primary_loss = primary_loss
        self._loss = loss


# 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_hypercolumn2.py
import tensorflow as tf
import selfsup
import os
import functools
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

            loss_chr_each = tf.multiply(chr_weights, tf.nn.sparse_softmax_cross_entropy_with_logits(labels=y_chr, logits=z_chr))
            loss_hue_each = tf.multiply(5 * y_huechr[..., 1], tf.nn.sparse_softmax_cross_entropy_with_logits(labels=y_hue, logits=z_hue), name='foo')
            hue_loss = tf.reduce_mean(loss_hue_each)
            chr_loss = tf.reduce_mean(loss_chr_each)
            primary_loss = hue_loss + chr_loss

        l2_layers = [
            info['weights']['pre_h_fc1:weights'],
            info['weights']['hue:weights'],
            info['weights']['chroma:weights'],
        ]
        with tf.name_scope('weight_decay'):
            wd = 1e-6
            l2_loss = tf.add_n([
                tf.nn.l2_loss(v) for v in l2_layers
            ])
            weight_decay = wd * l2_loss

        with tf.name_scope('loss'):
            loss = weight_decay + primary_loss


        self._losses = OrderedDict([
            ('hue', hue_loss),
            ('chr', chr_loss),
            ('+weight_decay', weight_decay),
        ])
        self._primary_loss = primary_loss
        self._loss = loss


        variables = info['vars']