<commit_before>import theano


class Dataset(object):
    def __init__(self, inputs, targets=None, name="dataset"):
        self.name = name
        self.inputs = inputs
        self.targets = targets
        self.symb_inputs = theano.tensor.matrix(name=self.name+'_inputs')
        self.symb_targets = theano.tensor.matrix(name=self.name+'_targets')

    @property
    def inputs(self):
        return self._inputs_shared

    @inputs.setter
    def inputs(self, value):
        self._inputs_shared = theano.shared(value, name=self.name + "_inputs", borrow=True)

    @property
    def targets(self):
        return self._targets_shared

    @targets.setter
    def targets(self, value):
        if value is not None:
            self._targets_shared = theano.shared(value, name=self.name + "_targets", borrow=True)
        else:
            self._targets_shared = None

    @property
    def input_size(self):
        return len(self.inputs.get_value()[0])

    @property
    def target_size(self):
        if self.targets is None:
            return 0
        else:
            return len(self.targets.get_value()[0])

    def __len__(self):
        return len(self.inputs.get_value())<commit_msg>Changed dataset input_size definition to support tensors<commit_after>import theano


class Dataset(object):
    def __init__(self, inputs, targets=None, name="dataset"):
        self.name = name
        self.inputs = inputs
        self.targets = targets
        self.symb_inputs = theano.tensor.matrix(name=self.name+'_inputs')
        self.symb_targets = theano.tensor.matrix(name=self.name+'_targets')

    @property
    def inputs(self):
        return self._inputs_shared

    @inputs.setter
    def inputs(self, value):
        self._inputs_shared = theano.shared(value, name=self.name + "_inputs", borrow=True)

    @property
    def targets(self):
        return self._targets_shared

    @targets.setter
    def targets(self, value):
        if value is not None:
            self._targets_shared = theano.shared(value, name=self.name + "_targets", borrow=True)
        else:
            self._targets_shared = None

    @property
    def input_size(self):
        return self.inputs.get_value().shape[-1]

    @property
    def target_size(self):
        if self.targets is None:
            return 0
        else:
            return self.targets.get_value().shape[-1]

    def __len__(self):
        return len(self.inputs.get_value())
{'fraction_non_alphanumeric': 0.10788720882713526, 'fraction_numerical': 0.002451982018798529, 'mean_word_length': 2.552975326560232, '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': '5976007', 'n_tokens_mistral': 746, 'n_tokens_neox': 708, 'n_words': 157}