<commit_before>"""Base class for the components in other modules."""
import numpy
import theano
from theano import tensor

#from pylearn.gd.sgd import sgd_updates
#from pylearn.algorithms.mcRBM import contrastive_cost, contrastive_grad
theano.config.warn.sum_div_dimshuffle_bug = False
floatX = theano.config.floatX
sharedX = lambda X, name : theano.shared(numpy.asarray(X, dtype=floatX), name=name)
if 0:
    print 'WARNING: using SLOW rng'
    RandomStreams = tensor.shared_randomstreams.RandomStreams
else:
    import theano.sandbox.rng_mrg
    RandomStreams = theano.sandbox.rng_mrg.MRG_RandomStreams

class Block(object):
    """
    Basic building block for deep architectures.
    """
    def __init__(self, **kwargs):
        self._params = []
        self.__dict__.update(kwargs)

    def alloc(cls, conf, rng=None):
        raise NotImplementedError('alloc')

    def load(self, load_dir, load_filename):
        raise NotImplementedError('load')

    def params(self):
        """
        Returns a list of *shared* learnable parameters that
        are, in your judgment, typically learned in this
        model.
        """
        return self._params

    def outputs(self):
        """Output to pass on to layers above."""
        raise NotImplementedError('outputs')
<commit_msg>BUGFIX: alloc in base class should be a @classmethod as well.<commit_after>"""Base class for the components in other modules."""
import numpy
import theano
from theano import tensor

#from pylearn.gd.sgd import sgd_updates
#from pylearn.algorithms.mcRBM import contrastive_cost, contrastive_grad
theano.config.warn.sum_div_dimshuffle_bug = False
floatX = theano.config.floatX
sharedX = lambda X, name : theano.shared(numpy.asarray(X, dtype=floatX), name=name)
if 0:
    print 'WARNING: using SLOW rng'
    RandomStreams = tensor.shared_randomstreams.RandomStreams
else:
    import theano.sandbox.rng_mrg
    RandomStreams = theano.sandbox.rng_mrg.MRG_RandomStreams

class Block(object):
    """
    Basic building block for deep architectures.
    """
    def __init__(self, **kwargs):
        self._params = []
        self.__dict__.update(kwargs)

    @classmethod
    def alloc(cls, conf, rng=None):
        raise NotImplementedError('alloc')

    def load(self, load_dir, load_filename):
        raise NotImplementedError('load')

    def params(self):
        """
        Returns a list of *shared* learnable parameters that
        are, in your judgment, typically learned in this
        model.
        """
        return self._params

    def outputs(self):
        """Output to pass on to layers above."""
        raise NotImplementedError('outputs')

{'fraction_non_alphanumeric': 0.09416195856873823, 'fraction_numerical': 0.0007532956685499058, 'mean_word_length': 3.375617792421746, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2661062', 'n_tokens_mistral': 802, 'n_tokens_neox': 786, 'n_words': 225}