# Path: reid/models/block.py
# class Block(object):
#     """Abstract base class for neural network layers and models"""
# 
#     def __init__(self):
#         self._params = []
# 
#     @property
#     def parameters(self):
#         return self._params
# 
#     @parameters.setter
#     def parameters(self, value):
#         self._params = value
# 
#     def get_output(self, x):
#         raise NotImplementedError
# 
#     def get_regularization(self, l):
#         return 0
# 
# Path: reid/models/active_functions.py
# def identity(x):
# def rectifier(x):
# 
# Path: reid/utils/math_utils.py
# def cell(default, *args):


import numpy
import theano
import theano.tensor as T
from reid.models.block import Block
from reid.models import active_functions as actfuncs
from reid.utils.math_utils import numpy_rng
        self._params = [self._W, self._b]

    def get_output(self, x):
        if self._image_shape is not None:
            x = x.reshape((x.shape[0],) + self._image_shape)

        z = T.nnet.conv.conv2d(
            input=x,
            filters=self._W,
            filter_shape=self._filter_shape)

        y = T.signal.downsample.max_pool_2d(
            input=z,
            ds=self._pool_shape,
            ignore_border=True)

        y = y + self._b.dimshuffle('x', 0, 'x', 'x')

        if self._active_func is not None:
            y = self._active_func(y)

        if self._flatten:
            y = y.flatten(2)

        return (y, []) if not self._through else (y, [y])

    def get_regulariation(self, l):
        return self._W.norm(l)



# Path: reid/models/block.py
# class Block(object):
#     """Abstract base class for neural network layers and models"""
# 
#     def __init__(self):
#         self._params = []
# 
#     @property
#     def parameters(self):
#         return self._params
# 
#     @parameters.setter
#     def parameters(self, value):
#         self._params = value
# 
#     def get_output(self, x):
#         raise NotImplementedError
# 
#     def get_regularization(self, l):
#         return 0
# 
# Path: reid/models/active_functions.py
# def identity(x):
# def rectifier(x):
# 
# Path: reid/utils/math_utils.py
# def cell(default, *args):


# Path: reid/models/layers.py
import numpy
import theano
import theano.tensor as T
from reid.models.block import Block
from reid.models import active_functions as actfuncs
from reid.utils.math_utils import numpy_rng

        self._params = [self._W, self._b]

    def get_output(self, x):
        if self._image_shape is not None:
            x = x.reshape((x.shape[0],) + self._image_shape)

        z = T.nnet.conv.conv2d(
            input=x,
            filters=self._W,
            filter_shape=self._filter_shape)

        y = T.signal.downsample.max_pool_2d(
            input=z,
            ds=self._pool_shape,
            ignore_border=True)

        y = y + self._b.dimshuffle('x', 0, 'x', 'x')

        if self._active_func is not None:
            y = self._active_func(y)

        if self._flatten:
            y = y.flatten(2)

        return (y, []) if not self._through else (y, [y])

    def get_regulariation(self, l):
        return self._W.norm(l)



class FilterParingLayer(Block):