# Path: keyphrase/config.py
# def setup_keyphrase_stable():
# def setup_keyphrase_train():
# def setup_keyphrase_baseline():
# 
# Path: emolga/dataset/build_dataset.py
# def serialize_to_file(obj, path, protocol=pickle.HIGHEST_PROTOCOL):
#     print('serialize to %s' % path)
#     f = open(path, 'wb')
#     pickle.dump(obj, f, protocol=protocol)
#     f.close()
# 
# def deserialize_from_file(path):
#     f = open(path, 'rb')
#     obj = pickle.load(f)
#     f.close()
#     return obj
# 
# def serialize_to_file_json(obj, path, protocol=pickle.HIGHEST_PROTOCOL):
#     f = open(path, 'w')
#     json.dump(obj, f)
#     f.close()
# 
# Path: emolga/utils/theano_utils.py
# def floatX(X):
#     return np.asarray(X, dtype=theano.config.floatX)


import json
import numpy
import theano
import logging
import deepdish as dd
from keyphrase import config
from emolga.dataset.build_dataset import serialize_to_file, deserialize_from_file, serialize_to_file_json
from emolga.utils.theano_utils import floatX
                                     updates=updates
                                     )
        logger.info('done.')

    def set_weights(self, weights):
        if hasattr(self, 'save_parm'):
            params = self.params + self.save_parm
        else:
            params = self.params

        for p, w in zip(params, weights):
            # print(p.name)
            if p.eval().shape != w.shape:
                raise Exception("Layer shape %s not compatible with weight shape %s." % (p.eval().shape, w.shape))
            p.set_value(floatX(w))

    def get_weights(self):
        weights = []
        for p in self.params:
            weights.append(p.get_value())

        if hasattr(self, 'save_parm'):
            for v in self.save_parm:
                weights.append(v.get_value())

        return weights

    def set_name(self, name):
        for i in range(len(self.params)):
            if self.params[i].name is None:

# Path: keyphrase/config.py
# def setup_keyphrase_stable():
# def setup_keyphrase_train():
# def setup_keyphrase_baseline():
# 
# Path: emolga/dataset/build_dataset.py
# def serialize_to_file(obj, path, protocol=pickle.HIGHEST_PROTOCOL):
#     print('serialize to %s' % path)
#     f = open(path, 'wb')
#     pickle.dump(obj, f, protocol=protocol)
#     f.close()
# 
# def deserialize_from_file(path):
#     f = open(path, 'rb')
#     obj = pickle.load(f)
#     f.close()
#     return obj
# 
# def serialize_to_file_json(obj, path, protocol=pickle.HIGHEST_PROTOCOL):
#     f = open(path, 'w')
#     json.dump(obj, f)
#     f.close()
# 
# Path: emolga/utils/theano_utils.py
# def floatX(X):
#     return np.asarray(X, dtype=theano.config.floatX)


# Path: emolga/models/core.py
import json
import numpy
import theano
import logging
import deepdish as dd
from keyphrase import config
from emolga.dataset.build_dataset import serialize_to_file, deserialize_from_file, serialize_to_file_json
from emolga.utils.theano_utils import floatX

                                     updates=updates
                                     )
        logger.info('done.')

    def set_weights(self, weights):
        if hasattr(self, 'save_parm'):
            params = self.params + self.save_parm
        else:
            params = self.params

        for p, w in zip(params, weights):
            # print(p.name)
            if p.eval().shape != w.shape:
                raise Exception("Layer shape %s not compatible with weight shape %s." % (p.eval().shape, w.shape))
            p.set_value(floatX(w))

    def get_weights(self):
        weights = []
        for p in self.params:
            weights.append(p.get_value())

        if hasattr(self, 'save_parm'):
            for v in self.save_parm:
                weights.append(v.get_value())

        return weights

    def set_name(self, name):
        for i in range(len(self.params)):
            if self.params[i].name is None:

                self.params[i].name = '%s_p%d' % (name, i)