# Path: piecewisecrf/slim/slim.py

# 
# Path: piecewisecrf/slim/ops.py
# UPDATE_OPS_COLLECTION = '_update_ops_'
# def batch_norm(inputs,
#                decay=0.999,
#                center=True,
#                scale=False,
#                epsilon=0.001,
#                moving_vars='moving_vars',
#                activation=None,
#                is_training=True,
#                trainable=True,
#                restore=True,
#                scope=None,
#                reuse=None):
# def _two_element_tuple(int_or_tuple):
# def conv2d(inputs,
#            num_filters_out,
#            kernel_size,
#            stride=1,
#            padding='SAME',
#            activation=tf.nn.relu,
#            stddev=0.01,
#            bias=0.0,
#            weight_decay=0,
#            batch_norm_params=None,
#            is_training=True,
#            trainable=True,
#            restore=True,
#            scope=None,
#            reuse=None,
#            init=None):
# def fc(inputs,
#        num_units_out,
#        activation=tf.nn.relu,
#        stddev=0.01,
#        bias=0.0,
#        weight_decay=0,
#        batch_norm_params=None,
#        is_training=True,
#        trainable=True,
#        restore=True,
#        scope=None,
#        reuse=None):
# def one_hot_encoding(labels, num_classes, scope=None):
# def max_pool(inputs, kernel_size, stride=2, padding='VALID', scope=None):
# def avg_pool(inputs, kernel_size, stride=2, padding='VALID', scope=None):
# def dropout(inputs, keep_prob=0.5, is_training=True, scope=None):
# def flatten(inputs, scope=None):
# def repeat_op(repetitions, inputs, op, *args, **kwargs):


import numpy as np
import tensorflow as tf
import piecewisecrf.config.prefs as prefs
import piecewisecrf.datasets.helpers.pairwise_label_generator as indices
import piecewisecrf.models.losses as losses
from piecewisecrf.slim import slim
from piecewisecrf.slim import ops
from piecewisecrf.slim import scopes
        Layer input tensor

    num_maps: int
        Number of output maps

    k: int
        Kernel size

    name: str
        Scope name

    init_layer: dict
        Map used for initializing layer weights

    activation: callable
        Activation function


    Returns
    -------
    op: tensorflow operation
        Convolution operation


    '''
    if init_layers:
        init_map = {'weights': init_layers[name + '/weights'],
                    'biases': init_layers[name + '/biases']}
    else:
        init_map = None

# Path: piecewisecrf/slim/slim.py

# 
# Path: piecewisecrf/slim/ops.py
# UPDATE_OPS_COLLECTION = '_update_ops_'
# def batch_norm(inputs,
#                decay=0.999,
#                center=True,
#                scale=False,
#                epsilon=0.001,
#                moving_vars='moving_vars',
#                activation=None,
#                is_training=True,
#                trainable=True,
#                restore=True,
#                scope=None,
#                reuse=None):
# def _two_element_tuple(int_or_tuple):
# def conv2d(inputs,
#            num_filters_out,
#            kernel_size,
#            stride=1,
#            padding='SAME',
#            activation=tf.nn.relu,
#            stddev=0.01,
#            bias=0.0,
#            weight_decay=0,
#            batch_norm_params=None,
#            is_training=True,
#            trainable=True,
#            restore=True,
#            scope=None,
#            reuse=None,
#            init=None):
# def fc(inputs,
#        num_units_out,
#        activation=tf.nn.relu,
#        stddev=0.01,
#        bias=0.0,
#        weight_decay=0,
#        batch_norm_params=None,
#        is_training=True,
#        trainable=True,
#        restore=True,
#        scope=None,
#        reuse=None):
# def one_hot_encoding(labels, num_classes, scope=None):
# def max_pool(inputs, kernel_size, stride=2, padding='VALID', scope=None):
# def avg_pool(inputs, kernel_size, stride=2, padding='VALID', scope=None):
# def dropout(inputs, keep_prob=0.5, is_training=True, scope=None):
# def flatten(inputs, scope=None):
# def repeat_op(repetitions, inputs, op, *args, **kwargs):


# Path: piecewisecrf/models/piecewisecrf_model.py
import numpy as np
import tensorflow as tf
import piecewisecrf.config.prefs as prefs
import piecewisecrf.datasets.helpers.pairwise_label_generator as indices
import piecewisecrf.models.losses as losses
from piecewisecrf.slim import slim
from piecewisecrf.slim import ops
from piecewisecrf.slim import scopes

        Layer input tensor

    num_maps: int
        Number of output maps

    k: int
        Kernel size

    name: str
        Scope name

    init_layer: dict
        Map used for initializing layer weights

    activation: callable
        Activation function


    Returns
    -------
    op: tensorflow operation
        Convolution operation


    '''
    if init_layers:
        init_map = {'weights': init_layers[name + '/weights'],
                    'biases': init_layers[name + '/biases']}
    else:
        init_map = None

    return slim.ops.conv2d(inputs, num_maps, [k, k], scope=name, init=init_map, activation=activation)