<commit_before>import unittest
import numpy as np
import theano

from keras.layers import recurrent

def recursive_runner(layer):
    layer.input = theano.shared(value=np.ones((10,10,10)))

    config = layer.get_config()

    for train in [True,False]:
        out = layer.get_output(train).eval()
        mask = layer.get_output_mask(train)

class TestRNNS(unittest.TestCase):
    def test_simple(self):
        for weights in [None, [np.ones((10,5))]]:
            for ret_seq in [True, False]:
                layer = recurrent.SimpleRNN(10, 5, return_sequences=ret_seq, weights=weights)
                recursive_runner(layer)

    def test_simple_deep(self):
        for weights in [None, [np.ones((10,5))]]:
            for ret_seq in [True, False]:
                layer = recurrent.SimpleDeepRNN(10, 5, return_sequences=ret_seq, weights=weights)
                recursive_runner(layer)

    def test_gru(self):
        for weights in [None, [np.ones((10,5))]]:
            for ret_seq in [True, False]:
                layer = recurrent.GRU(10, 5, return_sequences=ret_seq, weights=weights)
                recursive_runner(layer)

    def test_lstm(self):
        for weights in [None, [np.ones((10,5))]]:
            for ret_seq in [True, False]:
                layer = recurrent.LSTM(10, 5, return_sequences=ret_seq, weights=weights)
                recursive_runner(layer)


    def test_jzs1(self):
        for weights in [None, [np.ones((10,5))]]:
            for ret_seq in [True, False]:
                layer = recurrent.JZS1(10, 5, return_sequences=ret_seq, weights=weights)
                recursive_runner(layer)

    def test_jzs2(self):
        for weights in [None, [np.ones((10,5))]]:
            for ret_seq in [True, False]:
                layer = recurrent.JZS2(10, 5, return_sequences=ret_seq, weights=weights)
                recursive_runner(layer)

    def test_jzs3(self):
        for weights in [None, [np.ones((10,5))]]:
            for ret_seq in [True, False]:
                layer = recurrent.JZS3(10, 5, return_sequences=ret_seq, weights=weights)
                recursive_runner(layer)

if __name__ == '__main__':
    unittest.main()<commit_msg>put dimensions into variables<commit_after>import unittest
import numpy as np
import theano

from keras.layers import recurrent

nb_samples, timesteps, input_dim, output_dim = 3, 3, 10, 5


def _runner(layer_class):
    for weights in [None, [np.ones((input_dim, output_dim))]]:
        for ret_seq in [True, False]:
            layer = layer_class(input_dim, output_dim, return_sequences=ret_seq, weights=weights)
            layer.input = theano.shared(value=np.ones((nb_samples, timesteps, input_dim)))
            config = layer.get_config()

            for train in [True, False]:
                out = layer.get_output(train).eval()
                mask = layer.get_output_mask(train)


class TestRNNS(unittest.TestCase):
    def test_simple(self):
        _runner(recurrent.SimpleRNN)

    def test_simple_deep(self):
        _runner(recurrent.SimpleDeepRNN)

    def test_gru(self):
        _runner(recurrent.GRU)

    def test_lstm(self):
        _runner(recurrent.LSTM)

    def test_jzs1(self):
        _runner(recurrent.JZS1)

    def test_jzs2(self):
        _runner(recurrent.JZS2)

    def test_jzs3(self):
        _runner(recurrent.JZS3)


if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.11353583013860218, 'fraction_numerical': 0.019168386906517253, 'mean_word_length': 2.635584137191854, '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': '4657549', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1078, 'n_words': 240}