52dad3fc0691f41586b8ac23ecbd7ce9135f666c,gpytorch/utils/interpolation.py,Interpolation,_cubic_interpolation_kernel,#Interpolation#Any#,5

Before Change



        first_case = U[U <= 1]
        // u(s) = 1.5|s|^3 - 2.5|s|^2 + 1 when 0 < |s| < 1
        U[U <= 1] = ((1.5 * first_case - 2.5).mul(first_case)).mul(first_case) + 1

        // u(s) = -0.5|s|^3 + 2.5|s|^2 - 4|s| + 2 when 1 < |s| < 2
        second_case = U[(1 < U) & (U <= 2)]
        U[(1 < U) & (U <= 2)] = ((-0.5 * second_case + 2.5).mul(second_case) - 4).mul(second_case) + 2
        return U

    def interpolate(self, x_grid, x_target, interp_points=range(-2, 2)):

After Change


        it is only intended to be used on single dimensional data.
        
        U = scaled_grid_dist.abs()
        res = Variable(U.data.new(U.size()).zero_())

        U_lt_1 = (1 - U.floor().clamp(0, 1))  // U, if U < 1, 0 otherwise
        res = res + (((1.5 * U - 2.5).mul(U)).mul(U) + 1) * U_lt_1
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: cornellius-gp/gpytorch
Commit Name: 52dad3fc0691f41586b8ac23ecbd7ce9135f666c
Time: 2018-01-26
Author: gpleiss@gmail.com
File Name: gpytorch/utils/interpolation.py
Class Name: Interpolation
Method Name: _cubic_interpolation_kernel


Project Name: dmlc/dgl
Commit Name: 9c9ac7c960aff5e4e6524202483c774f407fcf42
Time: 2018-05-09
Author: coin2028@hotmail.com
File Name: model.py
Class Name: TreeGlimpsedClassifier
Method Name: forward


Project Name: jwyang/faster-rcnn.pytorch
Commit Name: 7929d68e8d79bae487858fef93e81d28aa708d40
Time: 2017-12-20
Author: jyang375@t1000.cc.gatech.edu
File Name: lib/model/roi_crop/functions/roi_crop.py
Class Name: RoICropFunction
Method Name: forward