# Path: sop_embed/extra.py
# def relu(x):
#     return T.switch(x > 0, x, 0)
# 
# Path: sop_embed/extra.py
# class NonLinearity:
#     RELU = "rectifier"
#     TANH = "tanh"
#     SIGMOID = "sigmoid"
# 
# Path: sop_embed/extra.py
# class CostType:
#     MeanSquared = "MeanSquaredCost"
#     CrossEntropy = "CrossEntropy"


import theano
import theano.tensor as T
import numpy as np
import cPickle as pkl
from theano.tensor.shared_randomstreams import RandomStreams
from layer import AEHiddenLayer, AEOutputLayer
from sop_embed.extra import relu
from sop_embed.extra import NonLinearity
from sop_embed.extra import CostType
from collections import OrderedDict
                if not tied_weights:
                    self.L2 += (self.hidden.W**2).sum()
            else:
                self.L2 += (self.hidden.W**2).sum()
                if not tied_weights:
                    self.L2 += (self.hidden.W_prime**2).sum()

        if input is not None:
            self.x = input
        else:
            self.x = T.matrix('x_input', dtype=theano.config.floatX)

    def catch_params(self):
        self.catched_params = []
        for param in self.params:
            self.catched_params.append(param.get_value())

    def nonlinearity_fn(self, d_in=None, recons=False):
        if self.nonlinearity == NonLinearity.SIGMOID:
            return T.nnet.sigmoid(d_in)
        elif self.nonlinearity == NonLinearity.RELU and not recons:
            return T.maximum(d_in, 0)
        elif self.nonlinearity == NonLinearity.RELU and recons:
            return T.nnet.softplus(d_in)
        elif self.nonlinearity == NonLinearity.TANH:
            return T.tanh(d_in)

    def get_non_linearity_fn(self):
        if self.nonlinearity == NonLinearity.SIGMOID:
            return T.nnet.sigmoid

# Path: sop_embed/extra.py
# def relu(x):
#     return T.switch(x > 0, x, 0)
# 
# Path: sop_embed/extra.py
# class NonLinearity:
#     RELU = "rectifier"
#     TANH = "tanh"
#     SIGMOID = "sigmoid"
# 
# Path: sop_embed/extra.py
# class CostType:
#     MeanSquared = "MeanSquaredCost"
#     CrossEntropy = "CrossEntropy"


# Path: sop_embed/ae.py
import theano
import theano.tensor as T
import numpy as np
import cPickle as pkl
from theano.tensor.shared_randomstreams import RandomStreams
from layer import AEHiddenLayer, AEOutputLayer
from sop_embed.extra import relu
from sop_embed.extra import NonLinearity
from sop_embed.extra import CostType
from collections import OrderedDict

                if not tied_weights:
                    self.L2 += (self.hidden.W**2).sum()
            else:
                self.L2 += (self.hidden.W**2).sum()
                if not tied_weights:
                    self.L2 += (self.hidden.W_prime**2).sum()

        if input is not None:
            self.x = input
        else:
            self.x = T.matrix('x_input', dtype=theano.config.floatX)

    def catch_params(self):
        self.catched_params = []
        for param in self.params:
            self.catched_params.append(param.get_value())

    def nonlinearity_fn(self, d_in=None, recons=False):
        if self.nonlinearity == NonLinearity.SIGMOID:
            return T.nnet.sigmoid(d_in)
        elif self.nonlinearity == NonLinearity.RELU and not recons:
            return T.maximum(d_in, 0)
        elif self.nonlinearity == NonLinearity.RELU and recons:
            return T.nnet.softplus(d_in)
        elif self.nonlinearity == NonLinearity.TANH:
            return T.tanh(d_in)

    def get_non_linearity_fn(self):
        if self.nonlinearity == NonLinearity.SIGMOID:
            return T.nnet.sigmoid

        elif self.nonlinearity == NonLinearity.RELU: