<commit_before># Modified work:
# -----------------------------------------------------------------------------
# Copyright (c) 2018 Preferred Infrastructure, Inc.
# Copyright (c) 2018 Preferred Networks, Inc.
# -----------------------------------------------------------------------------

# Original work:
# -----------------------------------------------------------------------------
# Copyright (c) 2015 by Contributors
# \file roi_pooling.cu
# \brief roi pooling operator
# \author <NAME>, <NAME>, <NAME>
# \changed to roi_align by <NAME>
# \file roi_align.cu
# \roi align operator described in Mask RCNN
# -----------------------------------------------------------------------------

import numpy
import six

import chainer
from chainer.backends import cuda
from chainer import function
from chainer.utils import type_check


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


def _get_bounds(i, limit):
    if i < -1 or i > limit:
        # out of range, so it is empty
        return None, None, None
    if i <= 0:
        i = 0
    i_low = int(numpy.floor(i))
    if i_low >= limit - 1:
        i_high = i_low = limit - 1
        i = float(i_low)
    else:
        i_high = i_low + 1
    return i, i_low, i_high


def _get_bilinear_interp_params(y, x, y_low, x_low, y_high, x_high):
    ly = y - y_low
    lx = x - x_low
    hy = 1. - ly
    hx = 1. - lx
    w1 = hy * hx
    w2 = hy * lx
    w3 = ly * hx
    w4 = ly * lx
    return w1, w2, w3, w4


_GET_BILINEAR_INTERP_KERNEL = '''
__device__
bool get_bounds(
    T &i, const int limit, int &i_low, int &i_high) {
    if (i < -1. || i > limit) {
        // empty
        return false;
    }
    if (i <= 0) {
        i = 0;
    }
    i_low = (int)i;
    if (i_low >= limit - 1) {
        i_high = i_low = limit - 1;
        i = (T)i_low;
    } else {
        i_high = i_low + 1;
    }
    return true;
}

__device__
void get_bilinear_interp_params(
    T y, T x, int y_low, int x_low, int y_high, int x_high,
    T &w1, T &w2, T &w3, T &w4) {
    T ly = y - y_low;
    T lx = x - x_low;
    T hy = 1. - ly;
    T hx = 1. - lx;
    w1 = hy * hx;
    w2 = hy * lx;
    w3 = ly * hx;
    w4 = ly * lx;
}
'''

<commit_msg>use p instead of i in roi_average_align_2d<commit_after># Modified work:
# -----------------------------------------------------------------------------
# Copyright (c) 2018 Preferred Infrastructure, Inc.
# Copyright (c) 2018 Preferred Networks, Inc.
# -----------------------------------------------------------------------------

# Original work:
# -----------------------------------------------------------------------------
# Copyright (c) 2015 by Contributors
# \file roi_pooling.cu
# \brief roi pooling operator
# \author <NAME>, <NAME>, <NAME>
# \changed to roi_align by <NAME>
# \file roi_align.cu
# \roi align operator described in Mask RCNN
# -----------------------------------------------------------------------------

import numpy
import six

import chainer
from chainer.backends import cuda
from chainer import function
from chainer.utils import type_check


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


def _get_bounds(p, limit):
    if p < -1 or p > limit:
        # out of range, so it is empty
        return None, None, None
    if p <= 0:
        p = 0
    low = int(numpy.floor(p))
    if low >= limit - 1:
        high = low = limit - 1
        p = float(low)
    else:
        high = low + 1
    return p, low, high


def _get_bilinear_interp_params(y, x, y_low, x_low, y_high, x_high):
    ly = y - y_low
    lx = x - x_low
    hy = 1. - ly
    hx = 1. - lx
    w1 = hy * hx
    w2 = hy * lx
    w3 = ly * hx
    w4 = ly * lx
    return w1, w2, w3, w4


_GET_BILINEAR_INTERP_KERNEL = '''
__device__
bool get_bounds(
    T &p, const int limit, int &low, int &high) {
    if (p < -1. || p > limit) {
        // empty
        return false;
    }
    if (p <= 0) {
        p = 0;
    }
    low = (int)p;
    if (low >= limit - 1) {
        high = low = limit - 1;
        p = (T)low;
    } else {
        high = low + 1;
    }
    return true;
}

__device__
void get_bilinear_interp_params(
    T y, T x, int y_low, int x_low, int y_high, int x_high,
    T &w1, T &w2, T &w3, T &w4) {
    T ly = y - y_low;
    T lx = x - x_low;
    T hy = 1. - ly;
    T hx = 1. - lx;
    w1 = hy * hx;
    w2 = hy * lx;
    w3 = ly * hx;
    w4 = ly * lx;
}
'''


{'fraction_non_alphanumeric': 0.241571779415048, 'fraction_numerical': 0.019870506809555703, 'mean_word_length': 1.3394255874673628, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '4146419', 'n_tokens_mistral': 1623, 'n_tokens_neox': 1555, 'n_words': 506}