<commit_before>
import numpy as np
import theano
import theano.tensor as T

class RootMeanSquare:
    def __init__(self, time=True, log=False):
        self._time = time
        self._expect_log = log

    def setup(self, batch_size):
        self.batch_size = batch_size

    def loss(self, y, t):
        # If there is a time dimension, reshape the input such that the
        # observations and time both appears as rows.
        if (self._time):
            t = t.ravel()
            y = y.transpose(0, 2, 1).reshape((y.shape[2] * y.shape[0], y.shape[1]))

        return T.sum(T.sqrt(T.sum((y - t)**2, axis=1) / y.shape[1])) / y.shape[0]<commit_msg>[fix] use mean function instread of sum / n<commit_after>
import numpy as np
import theano
import theano.tensor as T

class RootMeanSquare:
    def __init__(self, time=True, log=False):
        self._time = time
        self._expect_log = log

    def setup(self, batch_size):
        self.batch_size = batch_size

    def loss(self, y, t):
        # If there is a time dimension, reshape the input such that the
        # observations and time both appears as rows.
        if (self._time):
            t = t.ravel()
            y = y.transpose(0, 2, 1).reshape((y.shape[2] * y.shape[0], y.shape[1]))

        return T.mean(T.sqrt(T.mean((y - t)**2, axis=1)))
{'fraction_non_alphanumeric': 0.12557077625570776, 'fraction_numerical': 0.0136986301369863, 'mean_word_length': 2.4244791666666665, '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': '7513637', 'n_tokens_mistral': 449, 'n_tokens_neox': 431, 'n_words': 134}