<commit_before>import unittest

import numpy
import six

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


def _cross_covariance(y, z, dtype=numpy.float32):
    row = y.shape[1]
    col = z.shape[1]
    y, z = cuda.to_cpu(y), cuda.to_cpu(z)
    y_mean = y.mean(axis=0)
    z_mean = z.mean(axis=0)
    N = y.shape[0]
    loss_expect = numpy.zeros((row, col), dtype=dtype)
    for i in six.moves.xrange(row):
        for j in six.moves.xrange(col):
            for n in six.moves.xrange(N):
                loss_expect[i, j] += (y[n, i] - y_mean[i]) * (
                    z[n, j] - z_mean[j])
    loss_expect /= N
    return loss_expect


@testing.parameterize(*testing.product_dict(
    [{'dtype': numpy.float16,
      'forward_options': {'rtol': 1e-3, 'atol': 1e-3},
      'backward_options': {'rtol': 3e-2, 'atol': 3e-2},
      'double_backward_options': {'rtol': 5e-1, 'atol': 5e-1}},
     {'dtype': numpy.float32,
      'forward_options': {'rtol': 1e-4, 'atol': 1e-4},
      'backward_options': {'rtol': 1e-4, 'atol': 1e-4},
      'double_backward_options': {'rtol': 1e-4, 'atol': 1e-4}},
     {'dtype': numpy.float64,
      'forward_options': {'rtol': 1e-4, 'atol': 1e-4},
      'backward_options': {'rtol': 1e-4, 'atol': 1e-4},
      'double_backward_options': {'rtol': 1e-4, 'atol': 1e-4}},
     ],<commit_msg>Remove unused default argument<commit_after>import unittest

import numpy
import six

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


def _cross_covariance(y, z, dtype):
    row = y.shape[1]
    col = z.shape[1]
    y, z = cuda.to_cpu(y), cuda.to_cpu(z)
    y_mean = y.mean(axis=0)
    z_mean = z.mean(axis=0)
    N = y.shape[0]
    loss_expect = numpy.zeros((row, col), dtype=dtype)
    for i in six.moves.xrange(row):
        for j in six.moves.xrange(col):
            for n in six.moves.xrange(N):
                loss_expect[i, j] += (y[n, i] - y_mean[i]) * (
                    z[n, j] - z_mean[j])
    loss_expect /= N
    return loss_expect


@testing.parameterize(*testing.product_dict(
    [{'dtype': numpy.float16,
      'forward_options': {'rtol': 1e-3, 'atol': 1e-3},
      'backward_options': {'rtol': 3e-2, 'atol': 3e-2},
      'double_backward_options': {'rtol': 5e-1, 'atol': 5e-1}},
     {'dtype': numpy.float32,
      'forward_options': {'rtol': 1e-4, 'atol': 1e-4},
      'backward_options': {'rtol': 1e-4, 'atol': 1e-4},
      'double_backward_options': {'rtol': 1e-4, 'atol': 1e-4}},
     {'dtype': numpy.float64,
      'forward_options': {'rtol': 1e-4, 'atol': 1e-4},
      'backward_options': {'rtol': 1e-4, 'atol': 1e-4},
      'double_backward_options': {'rtol': 1e-4, 'atol': 1e-4}},
     ],
{'fraction_non_alphanumeric': 0.17628759073625994, 'fraction_numerical': 0.03318354649153128, 'mean_word_length': 3.0362622036262206, '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': '3404417', 'n_tokens_mistral': 1189, 'n_tokens_neox': 1143, 'n_words': 255}