<commit_before>from distutils.version import LooseVersion
import unittest
import numpy as np

from cleverhans.devtools.checks import CleverHansTest


class TestMNISTTutorialTF(CleverHansTest):
    def test_mnist_tutorial_tf(self):

        np.random.seed(42)
        import tensorflow as tf
        tf.set_random_seed(42)

        from cleverhans_tutorials import mnist_tutorial_tf

        # Run the MNIST tutorial on a dataset of reduced size
        test_dataset_indices = {'train_start': 0,
                                'train_end': 5000,
                                'test_start': 0,
                                'test_end': 333,
                                'nb_epochs': 2,
                                'testing': True}
        report = mnist_tutorial_tf.mnist_tutorial(**test_dataset_indices)

        # Check accuracy values contained in the AccuracyReport object
        self.assertGreater(report.train_clean_train_clean_eval, 0.97)
        self.assertLess(report.train_clean_train_adv_eval, 0.029)<commit_msg>Update test_mnist_tutorial_tf.py<commit_after>from distutils.version import LooseVersion
import unittest
import numpy as np

from cleverhans.devtools.checks import CleverHansTest


class TestMNISTTutorialTF(CleverHansTest):
    def test_mnist_tutorial_tf(self):

        np.random.seed(42)
        import tensorflow as tf
        tf.set_random_seed(42)

        from cleverhans_tutorials import mnist_tutorial_tf

        # Run the MNIST tutorial on a dataset of reduced size
        test_dataset_indices = {'train_start': 0,
                                'train_end': 5000,
                                'test_start': 0,
                                'test_end': 333,
                                'nb_epochs': 2,
                                'testing': True}
        report = mnist_tutorial_tf.mnist_tutorial(**test_dataset_indices)

        # Check accuracy values contained in the AccuracyReport object
        self.assertGreater(report.train_clean_train_clean_eval, 0.97)
        self.assertLess(report.train_clean_train_adv_eval, 0.036)
{'fraction_non_alphanumeric': 0.06276952563488261, 'fraction_numerical': 0.020124580737901295, 'mean_word_length': 2.130434782608696, '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': '7301324', 'n_tokens_mistral': 661, 'n_tokens_neox': 582, 'n_words': 130}