<commit_before>import itertools
import numpy
import six

from chainer import cuda
from chainer.utils import conv_nd_kernel
from chainer.utils.conv import get_conv_outsize


def im2col_nd_cpu(img, ks, ss, ps, pval=0, cover_all=False):
    # Assured consistency of dimensions of parameters by caller.
    n, c = img.shape[0:2]       # (n, c, d_1, d_2, ..., d_N)
    ds = img.shape[2:]
    outs = tuple([get_conv_outsize(d, k, s, p, cover_all)
                  for (d, k, s, p) in zip(ds, ks, ss, ps)])

    # Pad around image.
    pad_width = ((0, 0), (0, 0)) + tuple(
        [(p, p + s - 1) for (s, p) in zip(ss, ps)])
    img = numpy.pad(img, pad_width, mode='constant', constant_values=(pval,))

    # Make patch array with which we will compute correlation with filter.
    # shape: (n, c, k_1, k_2, ..., k_N, out_1, out_2, ..., out_N)
    shape = (n, c) + ks + outs
    col = numpy.ndarray(shape, dtype=img.dtype)

    # Fill the patch array.
    N = len(ds)<commit_msg>Fix to pass flake8.<commit_after>import itertools
import numpy
import six

from chainer import cuda
from chainer.utils.conv import get_conv_outsize
from chainer.utils import conv_nd_kernel


def im2col_nd_cpu(img, ks, ss, ps, pval=0, cover_all=False):
    # Assured consistency of dimensions of parameters by caller.
    n, c = img.shape[0:2]       # (n, c, d_1, d_2, ..., d_N)
    ds = img.shape[2:]
    outs = tuple([get_conv_outsize(d, k, s, p, cover_all)
                  for (d, k, s, p) in zip(ds, ks, ss, ps)])

    # Pad around image.
    pad_width = ((0, 0), (0, 0)) + tuple(
        [(p, p + s - 1) for (s, p) in zip(ss, ps)])
    img = numpy.pad(img, pad_width, mode='constant', constant_values=(pval,))

    # Make patch array with which we will compute correlation with filter.
    # shape: (n, c, k_1, k_2, ..., k_N, out_1, out_2, ..., out_N)
    shape = (n, c) + ks + outs
    col = numpy.ndarray(shape, dtype=img.dtype)

    # Fill the patch array.
    N = len(ds)
{'fraction_non_alphanumeric': 0.14570552147239263, 'fraction_numerical': 0.01687116564417178, 'mean_word_length': 2.875247524752475, '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': '887892', 'n_tokens_mistral': 762, 'n_tokens_neox': 738, 'n_words': 236}