          if (!between(y, 0, height-1)) continue;
          for (int x = xi_l; x <= xi_r; ++x) {
            if (!between(x, 0, width-1)) continue;
-           bias_x[id_point] = 2 * (xf - x); // multiply 2 since it is derivative of square
-           bias_y[id_point] = 2 * (yf - y); // multiply 2 since it is derivative of square
-           float weight = __expf(bias_x[id_point] * bias_x[id_point] + bias_y[id_point] * bias_y[id_point]);
+           bias_x[id_point] = 2 * (x - xf); // multiply 2 since it is derivative of square
+           bias_y[id_point] = 2 * (y - yf); // multiply 2 since it is derivative of square
+           float weight = __expf(-bias_x[id_point] * bias_x[id_point] - bias_y[id_point] * bias_y[id_point]);
            bias_x_weighted += weight * bias_x[id_point];
            bias_y_weighted += weight * bias_y[id_point];
            weight_sum += weight;

       if (!between(y, 0, height-1)) continue;
       for (int x = xi_l; x <= xi_r; ++x) {
         if (!between(x, 0, width-1)) continue;
         float weight = __expf((x - xf) * (x - xf) + (y - yf) * (y - yf));
         weight_sum += weight;
         weights[id_point] = weight;
         int address = masks_strideBatch * b + masks_strideHeight * y + masks_strideWidth * x;

         ++id_point;
       }
     }

     m /= weight_sum;

