<commit_before>import unittest

import numpy

import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition


def _pair(x):
    if isinstance(x, chainer.utils.collections_abc.Iterable):
        return x
    return x, x


@testing.parameterize(*testing.product({
    'sampling_ratio': [None, 1, 2, (None, 3), (1, 2)],
    'outsize': [5, 7, (5, 7)],
    'spatial_scale': [0.6, 1.0, 2.0],
}))
class TestROIAlign2D(unittest.TestCase):

    def setUp(self):
        N = 3
        n_channels = 3
        self.x = numpy.arange(
            N * n_channels * 12 * 8,
            dtype=numpy.float32).reshape((N, n_channels, 12, 8))
        numpy.random.shuffle(self.x)<commit_msg>test numpy.scalar in test_roi_average_align_2d.py<commit_after>import unittest

import numpy

import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition


def _pair(x):
    if isinstance(x, chainer.utils.collections_abc.Iterable):
        return x
    return x, x


@testing.parameterize(*testing.product({
    'sampling_ratio': [
        None, 1, 2, (None, 3), (1, 2),
        numpy.int32(1), numpy.int32(2),
        (None, numpy.int32(3)), (numpy.int32(1), numpy.int32(2)),
    ],
    'outsize': [
        5, 7, (5, 7),
        numpy.int32(5), numpy.int32(7),
        (numpy.int32(5), numpy.int32(7)),
    ],
    'spatial_scale': [
        0.6, 1.0, 2.0, numpy.float32(0.6), numpy.int32(2),
    ],
}))
class TestROIAlign2D(unittest.TestCase):

    def setUp(self):
        N = 3
        n_channels = 3
        self.x = numpy.arange(
            N * n_channels * 12 * 8,
            dtype=numpy.float32).reshape((N, n_channels, 12, 8))
        numpy.random.shuffle(self.x)
{'fraction_non_alphanumeric': 0.12998446400828587, 'fraction_numerical': 0.04505437597099948, 'mean_word_length': 2.8951612903225805, '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': '2373591', 'n_tokens_mistral': 723, 'n_tokens_neox': 671, 'n_words': 168}