# 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/slim/variables.py
# MODEL_VARIABLES = '_model_variables_'
# VARIABLES_TO_RESTORE = '_variables_to_restore_'
# def add_variable(var, restore=True):
# def get_variables(scope=None, suffix=None):
# def get_variables_to_restore():
# def get_variables_by_name(given_name, scope=None):
# def get_unique_variable(name):
#   def __init__(self,
#                num_parameter_servers=0,
#                ps_device='/job:ps',
#                placement='CPU:0'):
#   def __call__(self, op):
# def variable_device(device, name):
# def global_step(device=''):
# def variable(name, shape=None, dtype=tf.float32, initializer=None,
#              regularizer=None, trainable=True, collections=None, device='',
#              restore=True):
# class VariableDeviceChooser(object):


import numpy as np
import tensorflow as tf
from tensorflow.python.ops import control_flow_ops
from piecewisecrf.slim import ops
from piecewisecrf.slim import scopes
from piecewisecrf.slim import variables
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, [3, 1])
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(),
                           [5, height, width, 32])

  def testCreateHorizontalConv(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, [1, 3])
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(),
                           [5, height, width, 32])

  def testCreateConvWithStride(self):
    height, width = 6, 6
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, [3, 3], stride=2)
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(),
                           [5, height/2, width/2, 32])

  def testCreateConvCreatesWeightsAndBiasesVars(self):
    height, width = 3, 3
    images = tf.random_uniform((5, height, width, 3), seed=1)
    with self.test_session():

# 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/slim/variables.py
# MODEL_VARIABLES = '_model_variables_'
# VARIABLES_TO_RESTORE = '_variables_to_restore_'
# def add_variable(var, restore=True):
# def get_variables(scope=None, suffix=None):
# def get_variables_to_restore():
# def get_variables_by_name(given_name, scope=None):
# def get_unique_variable(name):
#   def __init__(self,
#                num_parameter_servers=0,
#                ps_device='/job:ps',
#                placement='CPU:0'):
#   def __call__(self, op):
# def variable_device(device, name):
# def global_step(device=''):
# def variable(name, shape=None, dtype=tf.float32, initializer=None,
#              regularizer=None, trainable=True, collections=None, device='',
#              restore=True):
# class VariableDeviceChooser(object):


# Path: piecewisecrf/slim/ops_test.py
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import control_flow_ops
from piecewisecrf.slim import ops
from piecewisecrf.slim import scopes
from piecewisecrf.slim import variables

    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, [3, 1])
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(),
                           [5, height, width, 32])

  def testCreateHorizontalConv(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, [1, 3])
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(),
                           [5, height, width, 32])

  def testCreateConvWithStride(self):
    height, width = 6, 6
    with self.test_session():
      images = tf.random_uniform((5, height, width, 3), seed=1)
      output = ops.conv2d(images, 32, [3, 3], stride=2)
      self.assertEquals(output.op.name, 'Conv/Relu')
      self.assertListEqual(output.get_shape().as_list(),
                           [5, height/2, width/2, 32])

  def testCreateConvCreatesWeightsAndBiasesVars(self):
    height, width = 3, 3
    images = tf.random_uniform((5, height, width, 3), seed=1)
    with self.test_session():

      self.assertFalse(variables.get_variables('conv1/weights'))