Generated by Cython 3.0.0

Yellow lines hint at Python interaction.
Click on a line that starts with a "+" to see the C code that Cython generated for it.

Raw output: utils_cython.c

+001: # cython -a src/utils_cython.pyx && python src/setup.py build_ext --inplace
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 002: # cd src/ && cython -a utils_cython.pyx && python setup.py build_ext --inplace && cd ..
 003: # cython: language_level=3, boundscheck=False, wraparound=False
 004: 
+005: language_level = 3
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_language_level, __pyx_int_3) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
+006: import numpy as np
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 007: cimport numpy as np
 008: cimport cython
 009: from libc.stdlib cimport rand, RAND_MAX
 010: from libc.time cimport clock, CLOCKS_PER_SEC
 011: 
 012: cdef extern from "math.h":
 013:     double sin(double x)
 014:     double sqrt(double x)
 015:     double cos(double x)
 016:     double exp(double x)
 017:     double fabs(double x)
 018: 
 019: cdef:
+020:     float M_PI = 3.14159265358979323846
  __pyx_v_12utils_cython_M_PI = 3.14159265358979323846;
+021:     int pixel_num_1m = 4
  __pyx_v_12utils_cython_pixel_num_1m = 4;
 022: 
+023: cdef int get_round(float a):
static int __pyx_f_12utils_cython_get_round(float __pyx_v_a) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_round", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("utils_cython.get_round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+024:     if a > 0:
  __pyx_t_1 = (__pyx_v_a > 0.0);
  if (__pyx_t_1) {
/* … */
  }
+025:         return int(a + 0.5)
    __pyx_r = ((int)(__pyx_v_a + 0.5));
    goto __pyx_L0;
 026:     else:
+027:         return -int(fabs(a) + 0.5)
  /*else*/ {
    __pyx_t_2 = __Pyx_PyInt_FromDouble((fabs(__pyx_v_a) + 0.5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 27, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    goto __pyx_L0;
  }
 028: 
+029: cdef np.float32_t get_dis_point(np.float32_t a, np.float32_t b):
static __pyx_t_5numpy_float32_t __pyx_f_12utils_cython_get_dis_point(__pyx_t_5numpy_float32_t __pyx_v_a, __pyx_t_5numpy_float32_t __pyx_v_b) {
  __pyx_t_5numpy_float32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_dis_point", 0);
/* … */
  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+030:     return sqrt(a * a + b * b)
  __pyx_r = sqrt(((__pyx_v_a * __pyx_v_a) + (__pyx_v_b * __pyx_v_b)));
  goto __pyx_L0;
 031: 
+032: cdef np.float32_t get_point_for_ratio(np.ndarray[np.float32_t, ndim=1] point, np.ndarray[np.float32_t, ndim=1] end,
static __pyx_t_5numpy_float32_t __pyx_f_12utils_cython_get_point_for_ratio(PyArrayObject *__pyx_v_point, PyArrayObject *__pyx_v_end, __pyx_t_5numpy_float32_t __pyx_v_ratio, int __pyx_v_c) {
  __Pyx_LocalBuf_ND __pyx_pybuffernd_end;
  __Pyx_Buffer __pyx_pybuffer_end;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_point;
  __Pyx_Buffer __pyx_pybuffer_point;
  __pyx_t_5numpy_float32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_point_for_ratio", 0);
  __pyx_pybuffer_point.pybuffer.buf = NULL;
  __pyx_pybuffer_point.refcount = 0;
  __pyx_pybuffernd_point.data = NULL;
  __pyx_pybuffernd_point.rcbuffer = &__pyx_pybuffer_point;
  __pyx_pybuffer_end.pybuffer.buf = NULL;
  __pyx_pybuffer_end.refcount = 0;
  __pyx_pybuffernd_end.data = NULL;
  __pyx_pybuffernd_end.rcbuffer = &__pyx_pybuffer_end;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_point.rcbuffer->pybuffer, (PyObject*)__pyx_v_point, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 32, __pyx_L1_error)
  }
  __pyx_pybuffernd_point.diminfo[0].strides = __pyx_pybuffernd_point.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_point.diminfo[0].shape = __pyx_pybuffernd_point.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_end.rcbuffer->pybuffer, (PyObject*)__pyx_v_end, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 32, __pyx_L1_error)
  }
  __pyx_pybuffernd_end.diminfo[0].strides = __pyx_pybuffernd_end.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_end.diminfo[0].shape = __pyx_pybuffernd_end.rcbuffer->pybuffer.shape[0];
/* … */
  /* function exit code */
  __pyx_L1_error:;
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_end.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_point.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("utils_cython.get_point_for_ratio", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_end.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_point.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 033:                                       np.float32_t ratio, int c):
+034:     return point[c] * (1.0 - ratio) + end[c] * ratio
  __pyx_t_1 = __pyx_v_c;
  __pyx_t_2 = __pyx_v_c;
  __pyx_r = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_point.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_point.diminfo[0].strides)) * (1.0 - __pyx_v_ratio)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_end.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_end.diminfo[0].strides)) * __pyx_v_ratio));
  goto __pyx_L0;
 035: 
+036: def _normalize(np.ndarray[np.float32_t, ndim=2] polygon, np.float32_t angle, np.float32_t center_point_y):
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_1_normalize(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_1_normalize = {"_normalize", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_1_normalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_1_normalize(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyArrayObject *__pyx_v_polygon = 0;
  __pyx_t_5numpy_float32_t __pyx_v_angle;
  __pyx_t_5numpy_float32_t __pyx_v_center_point_y;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_normalize (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_polygon,&__pyx_n_s_angle,&__pyx_n_s_center_point_y,0};
    PyObject* values[3] = {0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_polygon)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_angle)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_normalize", 1, 3, 3, 1); __PYX_ERR(0, 36, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_center_point_y)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_normalize", 1, 3, 3, 2); __PYX_ERR(0, 36, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_normalize") < 0)) __PYX_ERR(0, 36, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 3)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
    }
    __pyx_v_polygon = ((PyArrayObject *)values[0]);
    __pyx_v_angle = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_angle == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
    __pyx_v_center_point_y = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_center_point_y == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_normalize", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 36, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython._normalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_polygon), __pyx_ptype_5numpy_ndarray, 1, "polygon", 0))) __PYX_ERR(0, 36, __pyx_L1_error)
  __pyx_r = __pyx_pf_12utils_cython__normalize(__pyx_self, __pyx_v_polygon, __pyx_v_angle, __pyx_v_center_point_y);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython__normalize(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_polygon, __pyx_t_5numpy_float32_t __pyx_v_angle, __pyx_t_5numpy_float32_t __pyx_v_center_point_y) {
  __pyx_t_5numpy_float32_t __pyx_v_cos_;
  __pyx_t_5numpy_float32_t __pyx_v_sin_;
  __pyx_t_5numpy_float32_t __pyx_v_min_sqr_dis;
  __pyx_t_5numpy_float32_t __pyx_v_temp;
  int __pyx_v_i;
  int __pyx_v_n;
  PyArrayObject *__pyx_v_new_points = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new_points;
  __Pyx_Buffer __pyx_pybuffer_new_points;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_polygon;
  __Pyx_Buffer __pyx_pybuffer_polygon;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_normalize", 0);
  __pyx_pybuffer_new_points.pybuffer.buf = NULL;
  __pyx_pybuffer_new_points.refcount = 0;
  __pyx_pybuffernd_new_points.data = NULL;
  __pyx_pybuffernd_new_points.rcbuffer = &__pyx_pybuffer_new_points;
  __pyx_pybuffer_polygon.pybuffer.buf = NULL;
  __pyx_pybuffer_polygon.refcount = 0;
  __pyx_pybuffernd_polygon.data = NULL;
  __pyx_pybuffernd_polygon.rcbuffer = &__pyx_pybuffer_polygon;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_polygon.rcbuffer->pybuffer, (PyObject*)__pyx_v_polygon, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 36, __pyx_L1_error)
  }
  __pyx_pybuffernd_polygon.diminfo[0].strides = __pyx_pybuffernd_polygon.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_polygon.diminfo[0].shape = __pyx_pybuffernd_polygon.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_polygon.diminfo[1].strides = __pyx_pybuffernd_polygon.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_polygon.diminfo[1].shape = __pyx_pybuffernd_polygon.rcbuffer->pybuffer.shape[1];
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new_points.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_polygon.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("utils_cython._normalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new_points.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_polygon.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new_points);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__15 = PyTuple_Pack(10, __pyx_n_s_polygon, __pyx_n_s_angle, __pyx_n_s_center_point_y, __pyx_n_s_cos, __pyx_n_s_sin, __pyx_n_s_min_sqr_dis, __pyx_n_s_temp, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_new_points); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_1_normalize, 0, __pyx_n_s_normalize, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_normalize, __pyx_t_2) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_normalize, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 36, __pyx_L1_error)
 037:     cdef np.float32_t cos_, sin_, min_sqr_dis, temp
+038:     min_sqr_dis = 10000.0
  __pyx_v_min_sqr_dis = 10000.0;
 039:     cdef int i, n
+040:     cos_ = cos(angle)
  __pyx_v_cos_ = cos(__pyx_v_angle);
+041:     sin_ = sin(angle)
  __pyx_v_sin_ = sin(__pyx_v_angle);
+042:     n = polygon.shape[0]
  __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_polygon)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 42, __pyx_L1_error)
  __pyx_v_n = (__pyx_t_1[0]);
+043:     cdef np.ndarray[np.float32_t, ndim=2] new_points = np.zeros((n, 2), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 43, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new_points.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_new_points = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_new_points.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 43, __pyx_L1_error)
    } else {__pyx_pybuffernd_new_points.diminfo[0].strides = __pyx_pybuffernd_new_points.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new_points.diminfo[0].shape = __pyx_pybuffernd_new_points.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_new_points.diminfo[1].strides = __pyx_pybuffernd_new_points.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_new_points.diminfo[1].shape = __pyx_pybuffernd_new_points.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_new_points = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;
+044:     for i in range(n):
  __pyx_t_8 = __pyx_v_n;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;
+045:         new_points[i, 0] = polygon[i, 0] * cos_ - polygon[i, 1] * sin_
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_12 = 0;
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_14 = 1;
    __pyx_t_15 = __pyx_v_i;
    __pyx_t_16 = 0;
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_new_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_new_points.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_new_points.diminfo[1].strides) = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_polygon.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_polygon.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_polygon.diminfo[1].strides)) * __pyx_v_cos_) - ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_polygon.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_polygon.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_polygon.diminfo[1].strides)) * __pyx_v_sin_));
+046:         new_points[i, 1] = polygon[i, 0] * sin_ + polygon[i, 1] * cos_
    __pyx_t_14 = __pyx_v_i;
    __pyx_t_13 = 0;
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_11 = 1;
    __pyx_t_16 = __pyx_v_i;
    __pyx_t_15 = 1;
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_new_points.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_new_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_new_points.diminfo[1].strides) = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_polygon.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_polygon.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_polygon.diminfo[1].strides)) * __pyx_v_sin_) + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_polygon.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_polygon.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_polygon.diminfo[1].strides)) * __pyx_v_cos_));
+047:         temp = center_point_y - new_points[i, 1]
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_12 = 1;
    __pyx_v_temp = (__pyx_v_center_point_y - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_new_points.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_new_points.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_new_points.diminfo[1].strides)));
+048:         min_sqr_dis = min(min_sqr_dis, new_points[i, 0] * new_points[i, 0] + temp * temp)
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_11 = 0;
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_14 = 0;
    __pyx_t_17 = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_new_points.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_new_points.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_new_points.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_new_points.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_new_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_new_points.diminfo[1].strides))) + (__pyx_v_temp * __pyx_v_temp));
    __pyx_t_18 = __pyx_v_min_sqr_dis;
    if ((__pyx_t_17 < __pyx_t_18)) {
      __pyx_t_19 = __pyx_t_17;
    } else {
      __pyx_t_19 = __pyx_t_18;
    }
    __pyx_v_min_sqr_dis = __pyx_t_19;
  }
+049:     return new_points, min_sqr_dis
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_min_sqr_dis); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF((PyObject *)__pyx_v_new_points);
  __Pyx_GIVEREF((PyObject *)__pyx_v_new_points);
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_new_points));
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;
 050: 
+051: def normalize(polygon, cent_x, cent_y, angle, center_point):
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_3normalize(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_3normalize = {"normalize", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_3normalize, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_3normalize(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_polygon = 0;
  PyObject *__pyx_v_cent_x = 0;
  PyObject *__pyx_v_cent_y = 0;
  PyObject *__pyx_v_angle = 0;
  PyObject *__pyx_v_center_point = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normalize (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_polygon,&__pyx_n_s_cent_x,&__pyx_n_s_cent_y,&__pyx_n_s_angle,&__pyx_n_s_center_point,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_polygon)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cent_x)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("normalize", 1, 5, 5, 1); __PYX_ERR(0, 51, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cent_y)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("normalize", 1, 5, 5, 2); __PYX_ERR(0, 51, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_angle)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("normalize", 1, 5, 5, 3); __PYX_ERR(0, 51, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_center_point)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 51, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("normalize", 1, 5, 5, 4); __PYX_ERR(0, 51, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "normalize") < 0)) __PYX_ERR(0, 51, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
    }
    __pyx_v_polygon = values[0];
    __pyx_v_cent_x = values[1];
    __pyx_v_cent_y = values[2];
    __pyx_v_angle = values[3];
    __pyx_v_center_point = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("normalize", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 51, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython.normalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12utils_cython_2normalize(__pyx_self, __pyx_v_polygon, __pyx_v_cent_x, __pyx_v_cent_y, __pyx_v_angle, __pyx_v_center_point);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_2normalize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_polygon, PyObject *__pyx_v_cent_x, PyObject *__pyx_v_cent_y, PyObject *__pyx_v_angle, PyObject *__pyx_v_center_point) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normalize", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("utils_cython.normalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__17 = PyTuple_Pack(5, __pyx_n_s_polygon, __pyx_n_s_cent_x, __pyx_n_s_cent_y, __pyx_n_s_angle, __pyx_n_s_center_point); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_3normalize, 0, __pyx_n_s_normalize_2, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_normalize_2, __pyx_t_2) < 0) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_normalize_2, 51, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 51, __pyx_L1_error)
+052:     polygon[:, 0] -= cent_x
  __pyx_slice__3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__3);
  __Pyx_GIVEREF(__pyx_slice__3);
/* … */
  __Pyx_INCREF(__pyx_tuple__4);
  __pyx_t_1 = __pyx_tuple__4;
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_polygon, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_v_cent_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely((PyObject_SetItem(__pyx_v_polygon, __pyx_t_1, __pyx_t_3) < 0))) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_tuple__4 = PyTuple_Pack(2, __pyx_slice__3, __pyx_int_0); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);
+053:     polygon[:, 1] -= cent_y
  __Pyx_INCREF(__pyx_tuple__5);
  __pyx_t_1 = __pyx_tuple__5;
  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_polygon, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_v_cent_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely((PyObject_SetItem(__pyx_v_polygon, __pyx_t_1, __pyx_t_2) < 0))) __PYX_ERR(0, 53, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* … */
  __pyx_tuple__5 = PyTuple_Pack(2, __pyx_slice__3, __pyx_int_1); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 53, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);
+054:     return _normalize(polygon, angle, center_point[1])
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_normalize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_center_point, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_v_polygon, __pyx_v_angle, __pyx_t_4};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 3+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;
 055: 
+056: cdef np.float32_t get_sqr_dis_point(np.float32_t a, np.float32_t b):
static __pyx_t_5numpy_float32_t __pyx_f_12utils_cython_get_sqr_dis_point(__pyx_t_5numpy_float32_t __pyx_v_a, __pyx_t_5numpy_float32_t __pyx_v_b) {
  __pyx_t_5numpy_float32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sqr_dis_point", 0);
/* … */
  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+057:     return a * a + b * b
  __pyx_r = ((__pyx_v_a * __pyx_v_a) + (__pyx_v_b * __pyx_v_b));
  goto __pyx_L0;
 058: 
+059: def _get_pseudo_label(np.ndarray[np.float32_t, ndim=2] predicts, np.ndarray[np.float32_t, ndim=2] labels,
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_5_get_pseudo_label(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_5_get_pseudo_label = {"_get_pseudo_label", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_5_get_pseudo_label, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_5_get_pseudo_label(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyArrayObject *__pyx_v_predicts = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyArrayObject *__pyx_v_self_cost = 0;
  int __pyx_v_is_manhatan;
  int __pyx_v_match_l2;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_pseudo_label (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_predicts,&__pyx_n_s_labels,&__pyx_n_s_self_cost,&__pyx_n_s_is_manhatan,&__pyx_n_s_match_l2,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_predicts)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_labels)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_pseudo_label", 1, 5, 5, 1); __PYX_ERR(0, 59, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self_cost)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_pseudo_label", 1, 5, 5, 2); __PYX_ERR(0, 59, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_is_manhatan)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_pseudo_label", 1, 5, 5, 3); __PYX_ERR(0, 59, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_match_l2)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_pseudo_label", 1, 5, 5, 4); __PYX_ERR(0, 59, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_get_pseudo_label") < 0)) __PYX_ERR(0, 59, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
    }
    __pyx_v_predicts = ((PyArrayObject *)values[0]);
    __pyx_v_labels = ((PyArrayObject *)values[1]);
    __pyx_v_self_cost = ((PyArrayObject *)values[2]);
    __pyx_v_is_manhatan = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_is_manhatan == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error)
    __pyx_v_match_l2 = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_match_l2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_pseudo_label", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 59, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython._get_pseudo_label", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_predicts), __pyx_ptype_5numpy_ndarray, 1, "predicts", 0))) __PYX_ERR(0, 59, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) __PYX_ERR(0, 59, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self_cost), __pyx_ptype_5numpy_ndarray, 1, "self_cost", 0))) __PYX_ERR(0, 60, __pyx_L1_error)
  __pyx_r = __pyx_pf_12utils_cython_4_get_pseudo_label(__pyx_self, __pyx_v_predicts, __pyx_v_labels, __pyx_v_self_cost, __pyx_v_is_manhatan, __pyx_v_match_l2);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_4_get_pseudo_label(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_predicts, PyArrayObject *__pyx_v_labels, PyArrayObject *__pyx_v_self_cost, int __pyx_v_is_manhatan, int __pyx_v_match_l2) {
  int __pyx_v_i;
  int __pyx_v_n;
  int __pyx_v_j;
  int __pyx_v_t;
  int __pyx_v_k;
  int __pyx_v_r;
  PyArrayObject *__pyx_v_C = 0;
  PyArrayObject *__pyx_v_pseudo_label = 0;
  PyObject *__pyx_v_matched = NULL;
  PyObject *__pyx_v_linear_sum_assignment = NULL;
  PyObject *__pyx_v_r_list = NULL;
  PyObject *__pyx_v_c_list = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_C;
  __Pyx_Buffer __pyx_pybuffer_C;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_predicts;
  __Pyx_Buffer __pyx_pybuffer_predicts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_pseudo_label;
  __Pyx_Buffer __pyx_pybuffer_pseudo_label;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_self_cost;
  __Pyx_Buffer __pyx_pybuffer_self_cost;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_pseudo_label", 0);
  __pyx_pybuffer_C.pybuffer.buf = NULL;
  __pyx_pybuffer_C.refcount = 0;
  __pyx_pybuffernd_C.data = NULL;
  __pyx_pybuffernd_C.rcbuffer = &__pyx_pybuffer_C;
  __pyx_pybuffer_pseudo_label.pybuffer.buf = NULL;
  __pyx_pybuffer_pseudo_label.refcount = 0;
  __pyx_pybuffernd_pseudo_label.data = NULL;
  __pyx_pybuffernd_pseudo_label.rcbuffer = &__pyx_pybuffer_pseudo_label;
  __pyx_pybuffer_predicts.pybuffer.buf = NULL;
  __pyx_pybuffer_predicts.refcount = 0;
  __pyx_pybuffernd_predicts.data = NULL;
  __pyx_pybuffernd_predicts.rcbuffer = &__pyx_pybuffer_predicts;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  __pyx_pybuffer_self_cost.pybuffer.buf = NULL;
  __pyx_pybuffer_self_cost.refcount = 0;
  __pyx_pybuffernd_self_cost.data = NULL;
  __pyx_pybuffernd_self_cost.rcbuffer = &__pyx_pybuffer_self_cost;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_predicts.rcbuffer->pybuffer, (PyObject*)__pyx_v_predicts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 59, __pyx_L1_error)
  }
  __pyx_pybuffernd_predicts.diminfo[0].strides = __pyx_pybuffernd_predicts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_predicts.diminfo[0].shape = __pyx_pybuffernd_predicts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_predicts.diminfo[1].strides = __pyx_pybuffernd_predicts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_predicts.diminfo[1].shape = __pyx_pybuffernd_predicts.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 59, __pyx_L1_error)
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_labels.diminfo[1].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_labels.diminfo[1].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_self_cost.rcbuffer->pybuffer, (PyObject*)__pyx_v_self_cost, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 59, __pyx_L1_error)
  }
  __pyx_pybuffernd_self_cost.diminfo[0].strides = __pyx_pybuffernd_self_cost.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_self_cost.diminfo[0].shape = __pyx_pybuffernd_self_cost.rcbuffer->pybuffer.shape[0];
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_C.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_predicts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pseudo_label.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_self_cost.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("utils_cython._get_pseudo_label", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_C.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_predicts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pseudo_label.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_self_cost.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_C);
  __Pyx_XDECREF((PyObject *)__pyx_v_pseudo_label);
  __Pyx_XDECREF(__pyx_v_matched);
  __Pyx_XDECREF(__pyx_v_linear_sum_assignment);
  __Pyx_XDECREF(__pyx_v_r_list);
  __Pyx_XDECREF(__pyx_v_c_list);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__19 = PyTuple_Pack(18, __pyx_n_s_predicts, __pyx_n_s_labels, __pyx_n_s_self_cost, __pyx_n_s_is_manhatan, __pyx_n_s_match_l2, __pyx_n_s_a, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_j, __pyx_n_s_t, __pyx_n_s_k, __pyx_n_s_r, __pyx_n_s_C, __pyx_n_s_pseudo_label, __pyx_n_s_matched, __pyx_n_s_linear_sum_assignment, __pyx_n_s_r_list, __pyx_n_s_c_list); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_5_get_pseudo_label, 0, __pyx_n_s_get_pseudo_label, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_pseudo_label, __pyx_t_2) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_get_pseudo_label, 59, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 59, __pyx_L1_error)
 060:                       np.ndarray[np.float32_t, ndim=1] self_cost, int is_manhatan, int match_l2):
 061:     cdef np.float32_t a
 062:     cdef int i, n, j, t, k, r
+063:     n = predicts.shape[0]
  __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_predicts)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L1_error)
  __pyx_v_n = (__pyx_t_1[0]);
+064:     k = labels.shape[0]
  __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_labels)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L1_error)
  __pyx_v_k = (__pyx_t_1[0]);
+065:     assert n >= k
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (__pyx_v_n >= __pyx_v_k);
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(0, 65, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 65, __pyx_L1_error)
  #endif
+066:     cdef np.ndarray[np.float32_t, ndim=2] C = np.zeros((n, k), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 66, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_7);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_C.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_C = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_C.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 66, __pyx_L1_error)
    } else {__pyx_pybuffernd_C.diminfo[0].strides = __pyx_pybuffernd_C.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_C.diminfo[0].shape = __pyx_pybuffernd_C.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_C.diminfo[1].strides = __pyx_pybuffernd_C.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_C.diminfo[1].shape = __pyx_pybuffernd_C.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_C = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;
+067:     cdef np.ndarray[np.float32_t, ndim=2] pseudo_label = np.zeros((n, 2), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_2);
  __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 67, __pyx_L1_error)
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pseudo_label.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_pseudo_label = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_pseudo_label.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 67, __pyx_L1_error)
    } else {__pyx_pybuffernd_pseudo_label.diminfo[0].strides = __pyx_pybuffernd_pseudo_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pseudo_label.diminfo[0].shape = __pyx_pybuffernd_pseudo_label.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pseudo_label.diminfo[1].strides = __pyx_pybuffernd_pseudo_label.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pseudo_label.diminfo[1].shape = __pyx_pybuffernd_pseudo_label.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_9 = 0;
  __pyx_v_pseudo_label = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
+068:     matched = np.zeros(n, dtype=np.int32)
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_matched = __pyx_t_4;
  __pyx_t_4 = 0;
 069: 
+070:     if match_l2:
  __pyx_t_2 = (__pyx_v_match_l2 != 0);
  if (__pyx_t_2) {
/* … */
    goto __pyx_L3;
  }
+071:         for i in range(n):
    __pyx_t_10 = __pyx_v_n;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_i = __pyx_t_12;
+072:             for j in range(k):
      __pyx_t_13 = __pyx_v_k;
      __pyx_t_14 = __pyx_t_13;
      for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
        __pyx_v_j = __pyx_t_15;
+073:                 C[i, j] = get_sqr_dis_point(predicts[i, 0] - labels[j, 0], predicts[i, 1] - labels[j, 1]) + self_cost[i]
        __pyx_t_16 = __pyx_v_i;
        __pyx_t_17 = 0;
        __pyx_t_18 = __pyx_v_j;
        __pyx_t_19 = 0;
        __pyx_t_20 = __pyx_v_i;
        __pyx_t_21 = 1;
        __pyx_t_22 = __pyx_v_j;
        __pyx_t_23 = 1;
        __pyx_t_24 = __pyx_f_12utils_cython_get_sqr_dis_point(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_predicts.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_predicts.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_predicts.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_labels.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_labels.diminfo[1].strides))), ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_predicts.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_predicts.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_predicts.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_labels.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_labels.diminfo[1].strides)))); if (unlikely(__pyx_t_24 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L1_error)
        __pyx_t_23 = __pyx_v_i;
        __pyx_t_22 = __pyx_v_i;
        __pyx_t_21 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_C.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_C.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_C.diminfo[1].strides) = (__pyx_t_24 + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_self_cost.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_self_cost.diminfo[0].strides)));
      }
    }
+074:     elif is_manhatan:
  __pyx_t_2 = (__pyx_v_is_manhatan != 0);
  if (__pyx_t_2) {
/* … */
    goto __pyx_L3;
  }
+075:         for i in range(n):
    __pyx_t_10 = __pyx_v_n;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_i = __pyx_t_12;
+076:             for j in range(k):
      __pyx_t_13 = __pyx_v_k;
      __pyx_t_14 = __pyx_t_13;
      for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
        __pyx_v_j = __pyx_t_15;
+077:                 C[i, j] = fabs(predicts[i, 0] - labels[j, 0]) + fabs(predicts[i, 1] - labels[j, 1]) + self_cost[i]
        __pyx_t_23 = __pyx_v_i;
        __pyx_t_21 = 0;
        __pyx_t_22 = __pyx_v_j;
        __pyx_t_20 = 0;
        __pyx_t_19 = __pyx_v_i;
        __pyx_t_18 = 1;
        __pyx_t_17 = __pyx_v_j;
        __pyx_t_16 = 1;
        __pyx_t_25 = __pyx_v_i;
        __pyx_t_26 = __pyx_v_i;
        __pyx_t_27 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_C.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_C.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_C.diminfo[1].strides) = ((fabs(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_predicts.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_predicts.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_predicts.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_labels.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_labels.diminfo[1].strides)))) + fabs(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_predicts.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_predicts.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_predicts.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_labels.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_labels.diminfo[1].strides))))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_self_cost.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_self_cost.diminfo[0].strides)));
      }
    }
 078:     else:
+079:         for i in range(n):
  /*else*/ {
    __pyx_t_10 = __pyx_v_n;
    __pyx_t_11 = __pyx_t_10;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_i = __pyx_t_12;
+080:             for j in range(k):
      __pyx_t_13 = __pyx_v_k;
      __pyx_t_14 = __pyx_t_13;
      for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
        __pyx_v_j = __pyx_t_15;
+081:                 C[i, j] = get_dis_point(predicts[i, 0] - labels[j, 0], predicts[i, 1] - labels[j, 1]) + self_cost[i]
        __pyx_t_25 = __pyx_v_i;
        __pyx_t_16 = 0;
        __pyx_t_17 = __pyx_v_j;
        __pyx_t_18 = 0;
        __pyx_t_19 = __pyx_v_i;
        __pyx_t_20 = 1;
        __pyx_t_22 = __pyx_v_j;
        __pyx_t_21 = 1;
        __pyx_t_24 = __pyx_f_12utils_cython_get_dis_point(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_predicts.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_predicts.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_predicts.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_labels.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_labels.diminfo[1].strides))), ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_predicts.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_predicts.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_predicts.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_labels.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_labels.diminfo[1].strides)))); if (unlikely(__pyx_t_24 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error)
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_22 = __pyx_v_i;
        __pyx_t_20 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_C.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_C.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_C.diminfo[1].strides) = (__pyx_t_24 + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_self_cost.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_self_cost.diminfo[0].strides)));
      }
    }
  }
  __pyx_L3:;
 082: 
 083:     # remove out of function
+084:     from scipy.optimize import linear_sum_assignment
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_n_s_linear_sum_assignment);
  __Pyx_GIVEREF(__pyx_n_s_linear_sum_assignment);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_linear_sum_assignment);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_scipy_optimize, __pyx_t_4, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_linear_sum_assignment); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_v_linear_sum_assignment = __pyx_t_4;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+085:     r_list, c_list = linear_sum_assignment(C)
  __Pyx_INCREF(__pyx_v_linear_sum_assignment);
  __pyx_t_4 = __pyx_v_linear_sum_assignment; __pyx_t_7 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_10 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, ((PyObject *)__pyx_v_C)};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 85, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_28 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
    index = 0; __pyx_t_4 = __pyx_t_28(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L16_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_7 = __pyx_t_28(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L16_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_28(__pyx_t_5), 2) < 0) __PYX_ERR(0, 85, __pyx_L1_error)
    __pyx_t_28 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L17_unpacking_done;
    __pyx_L16_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_28 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 85, __pyx_L1_error)
    __pyx_L17_unpacking_done:;
  }
  __pyx_v_r_list = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_c_list = __pyx_t_7;
  __pyx_t_7 = 0;
+086:     r_list = r_list.astype(np.int32)
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_r_list, __pyx_n_s_astype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_10 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_r_list, __pyx_t_3);
  __pyx_t_3 = 0;
+087:     c_list = c_list.astype(np.int32)
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_c_list, __pyx_n_s_astype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_10 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_c_list, __pyx_t_3);
  __pyx_t_3 = 0;
 088: 
+089:     for i in range(k):
  __pyx_t_10 = __pyx_v_k;
  __pyx_t_11 = __pyx_t_10;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;
+090:         t = c_list[i]
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_c_list, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_t = __pyx_t_13;
+091:         r = r_list[i]
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_r_list, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_r = __pyx_t_13;
+092:         matched[r] = 1
    if (unlikely((__Pyx_SetItemInt(__pyx_v_matched, __pyx_v_r, __pyx_int_1, int, 1, __Pyx_PyInt_From_int, 0, 0, 0) < 0))) __PYX_ERR(0, 92, __pyx_L1_error)
+093:         pseudo_label[r, 0] = labels[t, 0]
    __pyx_t_21 = __pyx_v_t;
    __pyx_t_20 = 0;
    __pyx_t_22 = __pyx_v_r;
    __pyx_t_19 = 0;
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_pseudo_label.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_pseudo_label.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_pseudo_label.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_labels.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_labels.diminfo[1].strides));
+094:         pseudo_label[r, 1] = labels[t, 1]
    __pyx_t_20 = __pyx_v_t;
    __pyx_t_21 = 1;
    __pyx_t_19 = __pyx_v_r;
    __pyx_t_22 = 1;
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_pseudo_label.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_pseudo_label.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_pseudo_label.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_labels.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_labels.diminfo[1].strides));
  }
 095: 
+096:     return pseudo_label, C[r_list, c_list].sum(), matched
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_r_list);
  __Pyx_GIVEREF(__pyx_v_r_list);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_r_list);
  __Pyx_INCREF(__pyx_v_c_list);
  __Pyx_GIVEREF(__pyx_v_c_list);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_c_list);
  __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_C), __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_10 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[1] = {__pyx_t_4, };
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_10, 0+__pyx_t_10);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF((PyObject *)__pyx_v_pseudo_label);
  __Pyx_GIVEREF((PyObject *)__pyx_v_pseudo_label);
  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_pseudo_label));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
  __Pyx_INCREF(__pyx_v_matched);
  __Pyx_GIVEREF(__pyx_v_matched);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_matched);
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;
 097: 
+098: def get_pseudo_label(predicts, labels, self_cost, kwargs):
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_7get_pseudo_label(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_7get_pseudo_label = {"get_pseudo_label", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_7get_pseudo_label, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_7get_pseudo_label(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_predicts = 0;
  PyObject *__pyx_v_labels = 0;
  PyObject *__pyx_v_self_cost = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_pseudo_label (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_predicts,&__pyx_n_s_labels,&__pyx_n_s_self_cost,&__pyx_n_s_kwargs,0};
    PyObject* values[4] = {0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_predicts)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_labels)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_pseudo_label", 1, 4, 4, 1); __PYX_ERR(0, 98, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self_cost)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_pseudo_label", 1, 4, 4, 2); __PYX_ERR(0, 98, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kwargs)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 98, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_pseudo_label", 1, 4, 4, 3); __PYX_ERR(0, 98, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_pseudo_label") < 0)) __PYX_ERR(0, 98, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
    }
    __pyx_v_predicts = values[0];
    __pyx_v_labels = values[1];
    __pyx_v_self_cost = values[2];
    __pyx_v_kwargs = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_pseudo_label", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 98, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython.get_pseudo_label", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12utils_cython_6get_pseudo_label(__pyx_self, __pyx_v_predicts, __pyx_v_labels, __pyx_v_self_cost, __pyx_v_kwargs);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_6get_pseudo_label(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_predicts, PyObject *__pyx_v_labels, PyObject *__pyx_v_self_cost, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_is_manhatan = NULL;
  PyObject *__pyx_v_match_l2 = NULL;
  PyObject *__pyx_v_pseudo_label = NULL;
  PyObject *__pyx_v_cost = NULL;
  PyObject *__pyx_v_matched = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_pseudo_label", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("utils_cython.get_pseudo_label", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_is_manhatan);
  __Pyx_XDECREF(__pyx_v_match_l2);
  __Pyx_XDECREF(__pyx_v_pseudo_label);
  __Pyx_XDECREF(__pyx_v_cost);
  __Pyx_XDECREF(__pyx_v_matched);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__21 = PyTuple_Pack(9, __pyx_n_s_predicts, __pyx_n_s_labels, __pyx_n_s_self_cost, __pyx_n_s_kwargs, __pyx_n_s_is_manhatan, __pyx_n_s_match_l2, __pyx_n_s_pseudo_label, __pyx_n_s_cost, __pyx_n_s_matched); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_7get_pseudo_label, 0, __pyx_n_s_get_pseudo_label_2, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_pseudo_label_2, __pyx_t_2) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_get_pseudo_label_2, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 98, __pyx_L1_error)
+099:     is_manhatan = kwargs.get('is_manhatan', False)
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_is_manhatan = __pyx_t_2;
  __pyx_t_2 = 0;
/* … */
  __pyx_tuple__7 = PyTuple_Pack(2, __pyx_n_u_is_manhatan, Py_False); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);
+100:     match_l2 = kwargs.get('match_l2', False)
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_kwargs, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_match_l2 = __pyx_t_1;
  __pyx_t_1 = 0;
/* … */
  __pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_u_match_l2, Py_False); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);
+101:     pseudo_label, cost, matched = _get_pseudo_label(predicts, labels, self_cost, is_manhatan, match_l2)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_pseudo_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_3, __pyx_v_predicts, __pyx_v_labels, __pyx_v_self_cost, __pyx_v_is_manhatan, __pyx_v_match_l2};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 5+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 101, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 101, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 101, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_pseudo_label = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_cost = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_matched = __pyx_t_5;
  __pyx_t_5 = 0;
+102:     pseudo_label = pseudo_label[np.nonzero(matched)[0]]
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_nonzero); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_matched};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_pseudo_label, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_pseudo_label, __pyx_t_1);
  __pyx_t_1 = 0;
+103:     return pseudo_label, cost, matched
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_pseudo_label);
  __Pyx_GIVEREF(__pyx_v_pseudo_label);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pseudo_label);
  __Pyx_INCREF(__pyx_v_cost);
  __Pyx_GIVEREF(__pyx_v_cost);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_cost);
  __Pyx_INCREF(__pyx_v_matched);
  __Pyx_GIVEREF(__pyx_v_matched);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_matched);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 104: 
+105: def get_rotate_lane_matrix(lane_matrix, x, y, angle):
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_9get_rotate_lane_matrix(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_9get_rotate_lane_matrix = {"get_rotate_lane_matrix", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_9get_rotate_lane_matrix, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_9get_rotate_lane_matrix(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_lane_matrix = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_angle = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_rotate_lane_matrix (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lane_matrix,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_angle,0};
    PyObject* values[4] = {0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lane_matrix)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_rotate_lane_matrix", 1, 4, 4, 1); __PYX_ERR(0, 105, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_y)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_rotate_lane_matrix", 1, 4, 4, 2); __PYX_ERR(0, 105, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_angle)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_rotate_lane_matrix", 1, 4, 4, 3); __PYX_ERR(0, 105, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_rotate_lane_matrix") < 0)) __PYX_ERR(0, 105, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
    }
    __pyx_v_lane_matrix = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
    __pyx_v_angle = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_rotate_lane_matrix", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 105, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython.get_rotate_lane_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12utils_cython_8get_rotate_lane_matrix(__pyx_self, __pyx_v_lane_matrix, __pyx_v_x, __pyx_v_y, __pyx_v_angle);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_8get_rotate_lane_matrix(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_lane_matrix, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_angle) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_rotate_lane_matrix", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("utils_cython.get_rotate_lane_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__23 = PyTuple_Pack(4, __pyx_n_s_lane_matrix, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_angle); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_9get_rotate_lane_matrix, 0, __pyx_n_s_get_rotate_lane_matrix_2, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_rotate_lane_matrix_2, __pyx_t_2) < 0) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_get_rotate_lane_matrix_2, 105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 105, __pyx_L1_error)
+106:     return _get_rotate_lane_matrix(lane_matrix, x, y, angle)
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_rotate_lane_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_v_lane_matrix, __pyx_v_x, __pyx_v_y, __pyx_v_angle};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 4+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 107: 
+108: def _get_rotate_lane_matrix(np.ndarray[np.float32_t, ndim=2] lane_matrix, np.float32_t x, np.float32_t y, np.float32_t angle):
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_11_get_rotate_lane_matrix(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_11_get_rotate_lane_matrix = {"_get_rotate_lane_matrix", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_11_get_rotate_lane_matrix, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_11_get_rotate_lane_matrix(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyArrayObject *__pyx_v_lane_matrix = 0;
  __pyx_t_5numpy_float32_t __pyx_v_x;
  __pyx_t_5numpy_float32_t __pyx_v_y;
  __pyx_t_5numpy_float32_t __pyx_v_angle;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_rotate_lane_matrix (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lane_matrix,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_angle,0};
    PyObject* values[4] = {0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lane_matrix)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_rotate_lane_matrix", 1, 4, 4, 1); __PYX_ERR(0, 108, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_y)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_rotate_lane_matrix", 1, 4, 4, 2); __PYX_ERR(0, 108, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_angle)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_rotate_lane_matrix", 1, 4, 4, 3); __PYX_ERR(0, 108, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_get_rotate_lane_matrix") < 0)) __PYX_ERR(0, 108, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
    }
    __pyx_v_lane_matrix = ((PyArrayObject *)values[0]);
    __pyx_v_x = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_x == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error)
    __pyx_v_y = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_y == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error)
    __pyx_v_angle = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_angle == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_rotate_lane_matrix", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 108, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython._get_rotate_lane_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lane_matrix), __pyx_ptype_5numpy_ndarray, 1, "lane_matrix", 0))) __PYX_ERR(0, 108, __pyx_L1_error)
  __pyx_r = __pyx_pf_12utils_cython_10_get_rotate_lane_matrix(__pyx_self, __pyx_v_lane_matrix, __pyx_v_x, __pyx_v_y, __pyx_v_angle);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_10_get_rotate_lane_matrix(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_lane_matrix, __pyx_t_5numpy_float32_t __pyx_v_x, __pyx_t_5numpy_float32_t __pyx_v_y, __pyx_t_5numpy_float32_t __pyx_v_angle) {
  __pyx_t_5numpy_float32_t __pyx_v_sin_;
  __pyx_t_5numpy_float32_t __pyx_v_cos_;
  __pyx_t_5numpy_float32_t __pyx_v_dx;
  __pyx_t_5numpy_float32_t __pyx_v_dy;
  int __pyx_v_i;
  int __pyx_v_n;
  PyArrayObject *__pyx_v_res = 0;
  int __pyx_v_r;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lane_matrix;
  __Pyx_Buffer __pyx_pybuffer_lane_matrix;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_res;
  __Pyx_Buffer __pyx_pybuffer_res;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_rotate_lane_matrix", 0);
  __pyx_pybuffer_res.pybuffer.buf = NULL;
  __pyx_pybuffer_res.refcount = 0;
  __pyx_pybuffernd_res.data = NULL;
  __pyx_pybuffernd_res.rcbuffer = &__pyx_pybuffer_res;
  __pyx_pybuffer_lane_matrix.pybuffer.buf = NULL;
  __pyx_pybuffer_lane_matrix.refcount = 0;
  __pyx_pybuffernd_lane_matrix.data = NULL;
  __pyx_pybuffernd_lane_matrix.rcbuffer = &__pyx_pybuffer_lane_matrix;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lane_matrix.rcbuffer->pybuffer, (PyObject*)__pyx_v_lane_matrix, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 108, __pyx_L1_error)
  }
  __pyx_pybuffernd_lane_matrix.diminfo[0].strides = __pyx_pybuffernd_lane_matrix.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lane_matrix.diminfo[0].shape = __pyx_pybuffernd_lane_matrix.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_lane_matrix.diminfo[1].strides = __pyx_pybuffernd_lane_matrix.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_lane_matrix.diminfo[1].shape = __pyx_pybuffernd_lane_matrix.rcbuffer->pybuffer.shape[1];
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lane_matrix.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_res.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("utils_cython._get_rotate_lane_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lane_matrix.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_res.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__25 = PyTuple_Pack(12, __pyx_n_s_lane_matrix, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_angle, __pyx_n_s_sin, __pyx_n_s_cos, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_res, __pyx_n_s_r); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_11_get_rotate_lane_matrix, 0, __pyx_n_s_get_rotate_lane_matrix, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_rotate_lane_matrix, __pyx_t_2) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_get_rotate_lane_matrix, 108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 108, __pyx_L1_error)
 109:     cdef np.float32_t sin_, cos_, dx, dy
 110:     cdef int i, n
+111:     cos_ = cos(angle)
  __pyx_v_cos_ = cos(__pyx_v_angle);
+112:     sin_ = sin(angle)
  __pyx_v_sin_ = sin(__pyx_v_angle);
+113:     n = lane_matrix.shape[0]
  __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_lane_matrix)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L1_error)
  __pyx_v_n = (__pyx_t_1[0]);
+114:     cdef np.ndarray[np.float32_t, ndim=2] res = np.zeros((n, 20), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_int_20);
  __Pyx_GIVEREF(__pyx_int_20);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_20);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 114, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_res.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_res = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_res.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 114, __pyx_L1_error)
    } else {__pyx_pybuffernd_res.diminfo[0].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_res.diminfo[0].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_res.diminfo[1].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_res.diminfo[1].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_res = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;
+115:     for r in range(n):
  __pyx_t_8 = __pyx_v_n;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_r = __pyx_t_10;
+116:         for i in range(10):
    for (__pyx_t_11 = 0; __pyx_t_11 < 10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;
+117:             dx = lane_matrix[r, i * 2] - x
      __pyx_t_12 = __pyx_v_r;
      __pyx_t_13 = (__pyx_v_i * 2);
      __pyx_v_dx = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_lane_matrix.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_lane_matrix.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_lane_matrix.diminfo[1].strides)) - __pyx_v_x);
+118:             dy = lane_matrix[r, i * 2 + 1] - y
      __pyx_t_13 = __pyx_v_r;
      __pyx_t_12 = ((__pyx_v_i * 2) + 1);
      __pyx_v_dy = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_lane_matrix.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_lane_matrix.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_lane_matrix.diminfo[1].strides)) - __pyx_v_y);
+119:             res[r, i * 2] = dx * cos_ - dy * sin_
      __pyx_t_12 = __pyx_v_r;
      __pyx_t_13 = (__pyx_v_i * 2);
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_res.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_res.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_res.diminfo[1].strides) = ((__pyx_v_dx * __pyx_v_cos_) - (__pyx_v_dy * __pyx_v_sin_));
+120:             res[r, i * 2 + 1] = dx * sin_ + dy * cos_
      __pyx_t_13 = __pyx_v_r;
      __pyx_t_12 = ((__pyx_v_i * 2) + 1);
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_res.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_res.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_res.diminfo[1].strides) = ((__pyx_v_dx * __pyx_v_sin_) + (__pyx_v_dy * __pyx_v_cos_));
    }
  }
+121:     return res
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_res);
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;
 122: 
+123: cdef np.float32_t get_rand(np.float32_t l, np.float32_t r):
static __pyx_t_5numpy_float32_t __pyx_f_12utils_cython_get_rand(__pyx_t_5numpy_float32_t __pyx_v_l, __pyx_t_5numpy_float32_t __pyx_v_r) {
  __pyx_t_5numpy_float32_t __pyx_v_t;
  __pyx_t_5numpy_float32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_rand", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("utils_cython.get_rand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+124:     cdef np.float32_t t = rand()
  __pyx_v_t = rand();
+125:     return l + t / RAND_MAX * (r - l)
  if (unlikely(RAND_MAX == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 125, __pyx_L1_error)
  }
  __pyx_r = (__pyx_v_l + ((__pyx_v_t / ((__pyx_t_5numpy_float32_t)RAND_MAX)) * (__pyx_v_r - __pyx_v_l)));
  goto __pyx_L0;
 126: 
+127: cdef int get_rand_int(int l, int r):
static int __pyx_f_12utils_cython_get_rand_int(int __pyx_v_l, int __pyx_v_r) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_rand_int", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("utils_cython.get_rand_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+128:     return l + rand() % (r - l + 1)
  __pyx_t_1 = rand();
  __pyx_t_2 = ((__pyx_v_r - __pyx_v_l) + 1);
  if (unlikely(__pyx_t_2 == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 128, __pyx_L1_error)
  }
  __pyx_r = (__pyx_v_l + __Pyx_mod_long(__pyx_t_1, __pyx_t_2));
  goto __pyx_L0;
 129: 
+130: cdef np.float32_t get_value(np.ndarray[np.float32_t, ndim=2] goals_2D, np.ndarray[np.float32_t, ndim=1] scores,
static __pyx_t_5numpy_float32_t __pyx_f_12utils_cython_get_value(PyArrayObject *__pyx_v_goals_2D, PyArrayObject *__pyx_v_scores, PyArrayObject *__pyx_v_selected_points, int __pyx_v_n, CYTHON_UNUSED PyObject *__pyx_v_objective, int __pyx_v_cnt_sample, __pyx_t_5numpy_float32_t __pyx_v_MRratio, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  __pyx_t_5numpy_float32_t __pyx_v_value;
  __pyx_t_5numpy_float32_t __pyx_v_x;
  __pyx_t_5numpy_float32_t __pyx_v_y;
  __pyx_t_5numpy_float32_t __pyx_v_sum;
  __pyx_t_5numpy_float32_t __pyx_v_minFDE;
  __pyx_t_5numpy_float32_t __pyx_v_t_float;
  __pyx_t_5numpy_float32_t __pyx_v_miss_error;
  __pyx_t_5numpy_float32_t __pyx_v_stride;
  __pyx_t_5numpy_float32_t __pyx_v_s_x;
  __pyx_t_5numpy_float32_t __pyx_v_s_y;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_cnt;
  int __pyx_v_t_int;
  int __pyx_v_cnt_len;
  int __pyx_v_a;
  int __pyx_v_b;
  PyArrayObject *__pyx_v_point = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_goals_2D;
  __Pyx_Buffer __pyx_pybuffer_goals_2D;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_point;
  __Pyx_Buffer __pyx_pybuffer_point;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_scores;
  __Pyx_Buffer __pyx_pybuffer_scores;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_selected_points;
  __Pyx_Buffer __pyx_pybuffer_selected_points;
  __pyx_t_5numpy_float32_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_value", 0);
  __pyx_pybuffer_point.pybuffer.buf = NULL;
  __pyx_pybuffer_point.refcount = 0;
  __pyx_pybuffernd_point.data = NULL;
  __pyx_pybuffernd_point.rcbuffer = &__pyx_pybuffer_point;
  __pyx_pybuffer_goals_2D.pybuffer.buf = NULL;
  __pyx_pybuffer_goals_2D.refcount = 0;
  __pyx_pybuffernd_goals_2D.data = NULL;
  __pyx_pybuffernd_goals_2D.rcbuffer = &__pyx_pybuffer_goals_2D;
  __pyx_pybuffer_scores.pybuffer.buf = NULL;
  __pyx_pybuffer_scores.refcount = 0;
  __pyx_pybuffernd_scores.data = NULL;
  __pyx_pybuffernd_scores.rcbuffer = &__pyx_pybuffer_scores;
  __pyx_pybuffer_selected_points.pybuffer.buf = NULL;
  __pyx_pybuffer_selected_points.refcount = 0;
  __pyx_pybuffernd_selected_points.data = NULL;
  __pyx_pybuffernd_selected_points.rcbuffer = &__pyx_pybuffer_selected_points;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer, (PyObject*)__pyx_v_goals_2D, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 130, __pyx_L1_error)
  }
  __pyx_pybuffernd_goals_2D.diminfo[0].strides = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_goals_2D.diminfo[0].shape = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_goals_2D.diminfo[1].strides = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_goals_2D.diminfo[1].shape = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scores.rcbuffer->pybuffer, (PyObject*)__pyx_v_scores, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 130, __pyx_L1_error)
  }
  __pyx_pybuffernd_scores.diminfo[0].strides = __pyx_pybuffernd_scores.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scores.diminfo[0].shape = __pyx_pybuffernd_scores.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selected_points.rcbuffer->pybuffer, (PyObject*)__pyx_v_selected_points, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 130, __pyx_L1_error)
  }
  __pyx_pybuffernd_selected_points.diminfo[0].strides = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selected_points.diminfo[0].shape = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selected_points.diminfo[1].strides = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selected_points.diminfo[1].shape = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.shape[1];
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_point.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selected_points.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("utils_cython.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_point.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selected_points.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_point);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 131:                             np.ndarray[np.float32_t, ndim=2] selected_points, int n, objective, int cnt_sample, np.float32_t MRratio,
 132:                             kwargs):
+133:     cdef np.float32_t value = 0.0, cnt_hit, x, y, sum, minFDE, t_float, miss_error, stride, s_x, s_y
  __pyx_v_value = 0.0;
+134:     cdef int i, j, k, need, cnt, t_int, objective_int, cnt_len = 0, a, b
  __pyx_v_cnt_len = 0;
+135:     cdef np.ndarray[np.float32_t, ndim=1] point = np.zeros(2, dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__9, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 135, __pyx_L1_error)
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_point.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_point = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_point.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 135, __pyx_L1_error)
    } else {__pyx_pybuffernd_point.diminfo[0].strides = __pyx_pybuffernd_point.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_point.diminfo[0].shape = __pyx_pybuffernd_point.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_5 = 0;
  __pyx_v_point = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
/* … */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_int_2); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);
 136: 
+137:     for i in range(100):
  for (__pyx_t_6 = 0; __pyx_t_6 < 0x64; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;
+138:         if i * i == cnt_sample:
    __pyx_t_7 = ((__pyx_v_i * __pyx_v_i) == __pyx_v_cnt_sample);
    if (__pyx_t_7) {
/* … */
    }
  }
+139:             cnt_len = i
      __pyx_v_cnt_len = __pyx_v_i;
+140:     if cnt_len == 0:
  __pyx_t_7 = (__pyx_v_cnt_len == 0);
  if (__pyx_t_7) {
/* … */
  }
+141:         assert False, 'cnt_sample != square'
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      if (unlikely(!0)) {
        __Pyx_Raise(__pyx_builtin_AssertionError, __pyx_kp_u_cnt_sample_square, 0, 0);
        __PYX_ERR(0, 141, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 141, __pyx_L1_error)
    #endif
 142: 
+143:     for i in range(n):
  __pyx_t_6 = __pyx_v_n;
  __pyx_t_8 = __pyx_t_6;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;
+144:         point[0], point[1] = goals_2D[i, 0], goals_2D[i, 1]
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = 0;
    __pyx_t_12 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_goals_2D.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_goals_2D.diminfo[1].strides));
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_10 = 1;
    __pyx_t_13 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_goals_2D.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_goals_2D.diminfo[1].strides));
    __pyx_t_10 = 0;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_point.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_point.diminfo[0].strides) = __pyx_t_12;
    __pyx_t_10 = 1;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_point.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_point.diminfo[0].strides) = __pyx_t_13;
+145:         sum = 0.0
    __pyx_v_sum = 0.0;
+146:         t_int = int(scores[i] * 1000)
    __pyx_t_10 = __pyx_v_i;
    __pyx_v_t_int = ((int)((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_scores.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_scores.diminfo[0].strides)) * 1000.0));
 147: 
+148:         if t_int > 10:
    __pyx_t_7 = (__pyx_v_t_int > 10);
    if (__pyx_t_7) {
/* … */
      goto __pyx_L9;
    }
+149:             cnt = cnt_len * 3
      __pyx_v_cnt = (__pyx_v_cnt_len * 3);
+150:         elif t_int > 5:
    __pyx_t_7 = (__pyx_v_t_int > 5);
    if (__pyx_t_7) {
/* … */
      goto __pyx_L9;
    }
+151:             cnt = cnt_len * 2
      __pyx_v_cnt = (__pyx_v_cnt_len * 2);
 152:         else:
+153:             cnt = cnt_len
    /*else*/ {
      __pyx_v_cnt = __pyx_v_cnt_len;
    }
    __pyx_L9:;
 154: 
+155:         t_float = cnt
    __pyx_v_t_float = __pyx_v_cnt;
+156:         stride = 1.0 / t_float
    if (unlikely(__pyx_v_t_float == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 156, __pyx_L1_error)
    }
    __pyx_v_stride = (1.0 / ((double)__pyx_v_t_float));
 157: 
+158:         s_x = point[0] - 0.5 + stride / 2.0
    __pyx_t_10 = 0;
    __pyx_v_s_x = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_point.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_point.diminfo[0].strides)) - 0.5) + (((double)__pyx_v_stride) / 2.0));
+159:         s_y = point[1] - 0.5 + stride / 2.0
    __pyx_t_10 = 1;
    __pyx_v_s_y = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_point.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_point.diminfo[0].strides)) - 0.5) + (((double)__pyx_v_stride) / 2.0));
 160: 
+161:         for a in range(cnt):
    __pyx_t_14 = __pyx_v_cnt;
    __pyx_t_15 = __pyx_t_14;
    for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
      __pyx_v_a = __pyx_t_16;
+162:             for b in range(cnt):
      __pyx_t_17 = __pyx_v_cnt;
      __pyx_t_18 = __pyx_t_17;
      for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
        __pyx_v_b = __pyx_t_19;
 163:                 # x = get_rand(point[0] - 0.5, point[0] + 0.5)
 164:                 # y = get_rand(point[1] - 0.5, point[1] + 0.5)
+165:                 x = s_x + a * stride
        __pyx_v_x = (__pyx_v_s_x + (__pyx_v_a * __pyx_v_stride));
+166:                 y = s_y + b * stride
        __pyx_v_y = (__pyx_v_s_y + (__pyx_v_b * __pyx_v_stride));
+167:                 minFDE = 10000.0
        __pyx_v_minFDE = 10000.0;
+168:                 miss_error = 10.0
        __pyx_v_miss_error = 10.0;
+169:                 for j in range(6):
        for (__pyx_t_20 = 0; __pyx_t_20 < 6; __pyx_t_20+=1) {
          __pyx_v_j = __pyx_t_20;
+170:                     t_float = get_dis_point(x - selected_points[j, 0], y - selected_points[j, 1])
          __pyx_t_10 = __pyx_v_j;
          __pyx_t_11 = 0;
          __pyx_t_21 = __pyx_v_j;
          __pyx_t_22 = 1;
          __pyx_t_13 = __pyx_f_12utils_cython_get_dis_point((__pyx_v_x - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_selected_points.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_selected_points.diminfo[1].strides))), (__pyx_v_y - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_selected_points.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_selected_points.diminfo[1].strides)))); if (unlikely(__pyx_t_13 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __pyx_L1_error)
          __pyx_v_t_float = __pyx_t_13;
+171:                     if t_float < minFDE:
          __pyx_t_7 = (__pyx_v_t_float < __pyx_v_minFDE);
          if (__pyx_t_7) {
/* … */
          }
        }
+172:                         minFDE = t_float
            __pyx_v_minFDE = __pyx_v_t_float;
+173:                 if minFDE <= 2.0:
        __pyx_t_7 = (__pyx_v_minFDE <= 2.0);
        if (__pyx_t_7) {
/* … */
        }
+174:                     miss_error = 0.0
          __pyx_v_miss_error = 0.0;
+175:                 sum += minFDE * (1.0 - MRratio) + miss_error * MRratio
        __pyx_v_sum = (__pyx_v_sum + ((__pyx_v_minFDE * (1.0 - __pyx_v_MRratio)) + (__pyx_v_miss_error * __pyx_v_MRratio)));
      }
    }
+176:         sum /= cnt * cnt
    __pyx_t_14 = (__pyx_v_cnt * __pyx_v_cnt);
    if (unlikely(__pyx_t_14 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 176, __pyx_L1_error)
    }
    __pyx_v_sum = (__pyx_v_sum / __pyx_t_14);
+177:         value += scores[i] * sum
    __pyx_t_22 = __pyx_v_i;
    __pyx_v_value = (__pyx_v_value + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_scores.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_scores.diminfo[0].strides)) * __pyx_v_sum));
  }
 178: 
+179:     return value
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;
 180: 
+181: args = None
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_args, Py_None) < 0) __PYX_ERR(0, 181, __pyx_L1_error)
 182: 
+183: def _get_optimal_targets(np.ndarray[np.float32_t, ndim=2] goals_2D, np.ndarray[np.float32_t, ndim=1] scores,
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_13_get_optimal_targets(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_13_get_optimal_targets = {"_get_optimal_targets", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_13_get_optimal_targets, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_13_get_optimal_targets(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyArrayObject *__pyx_v_goals_2D = 0;
  PyArrayObject *__pyx_v_scores = 0;
  CYTHON_UNUSED PyObject *__pyx_v_file_name = 0;
  PyObject *__pyx_v_objective = 0;
  int __pyx_v_num_step;
  int __pyx_v_cnt_sample;
  PyObject *__pyx_v_MRratio = 0;
  float __pyx_v_opti_time;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_optimal_targets (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_goals_2D,&__pyx_n_s_scores,&__pyx_n_s_file_name,&__pyx_n_s_objective,&__pyx_n_s_num_step,&__pyx_n_s_cnt_sample,&__pyx_n_s_MRratio,&__pyx_n_s_opti_time,&__pyx_n_s_kwargs,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_goals_2D)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_scores)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_optimal_targets", 1, 9, 9, 1); __PYX_ERR(0, 183, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file_name)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_optimal_targets", 1, 9, 9, 2); __PYX_ERR(0, 183, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_objective)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_optimal_targets", 1, 9, 9, 3); __PYX_ERR(0, 183, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_num_step)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_optimal_targets", 1, 9, 9, 4); __PYX_ERR(0, 183, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_cnt_sample)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_optimal_targets", 1, 9, 9, 5); __PYX_ERR(0, 183, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_MRratio)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_optimal_targets", 1, 9, 9, 6); __PYX_ERR(0, 183, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_opti_time)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_optimal_targets", 1, 9, 9, 7); __PYX_ERR(0, 183, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kwargs)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_optimal_targets", 1, 9, 9, 8); __PYX_ERR(0, 183, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_get_optimal_targets") < 0)) __PYX_ERR(0, 183, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 9)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
      values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
      values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
      values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
      values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
    }
    __pyx_v_goals_2D = ((PyArrayObject *)values[0]);
    __pyx_v_scores = ((PyArrayObject *)values[1]);
    __pyx_v_file_name = values[2];
    __pyx_v_objective = values[3];
    __pyx_v_num_step = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_num_step == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L3_error)
    __pyx_v_cnt_sample = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_cnt_sample == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L3_error)
    __pyx_v_MRratio = values[6];
    __pyx_v_opti_time = __pyx_PyFloat_AsFloat(values[7]); if (unlikely((__pyx_v_opti_time == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 184, __pyx_L3_error)
    __pyx_v_kwargs = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_optimal_targets", 1, 9, 9, __pyx_nargs); __PYX_ERR(0, 183, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython._get_optimal_targets", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_goals_2D), __pyx_ptype_5numpy_ndarray, 1, "goals_2D", 0))) __PYX_ERR(0, 183, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scores), __pyx_ptype_5numpy_ndarray, 1, "scores", 0))) __PYX_ERR(0, 183, __pyx_L1_error)
  __pyx_r = __pyx_pf_12utils_cython_12_get_optimal_targets(__pyx_self, __pyx_v_goals_2D, __pyx_v_scores, __pyx_v_file_name, __pyx_v_objective, __pyx_v_num_step, __pyx_v_cnt_sample, __pyx_v_MRratio, __pyx_v_opti_time, __pyx_v_kwargs);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_12_get_optimal_targets(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_goals_2D, PyArrayObject *__pyx_v_scores, CYTHON_UNUSED PyObject *__pyx_v_file_name, PyObject *__pyx_v_objective, int __pyx_v_num_step, int __pyx_v_cnt_sample, PyObject *__pyx_v_MRratio, float __pyx_v_opti_time, PyObject *__pyx_v_kwargs) {
  __pyx_t_5numpy_float32_t __pyx_v_t;
  __pyx_t_5numpy_float32_t __pyx_v_threshold;
  __pyx_t_5numpy_float32_t __pyx_v_expectation;
  __pyx_t_5numpy_float32_t __pyx_v_nxt_expectation;
  __pyx_t_5numpy_float32_t __pyx_v_lr;
  __pyx_t_5numpy_float32_t __pyx_v_ratio;
  __pyx_t_5numpy_float32_t __pyx_v_fire_prob;
  __pyx_t_5numpy_float32_t __pyx_v_min_expectation;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_n;
  int __pyx_v_m;
  int __pyx_v_t_int;
  int __pyx_v_step;
  int __pyx_v_op;
  int __pyx_v_ok;
  int __pyx_v_go;
  PyArrayObject *__pyx_v_ans_points = 0;
  PyArrayObject *__pyx_v_nxt_points = 0;
  PyArrayObject *__pyx_v_pred_probs = 0;
  float __pyx_v_best_expectation;
  PyArrayObject *__pyx_v_best_points = 0;
  float __pyx_v_start_time;
  long __pyx_v_argmin;
  long __pyx_v_k;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ans_points;
  __Pyx_Buffer __pyx_pybuffer_ans_points;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_best_points;
  __Pyx_Buffer __pyx_pybuffer_best_points;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_goals_2D;
  __Pyx_Buffer __pyx_pybuffer_goals_2D;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nxt_points;
  __Pyx_Buffer __pyx_pybuffer_nxt_points;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_pred_probs;
  __Pyx_Buffer __pyx_pybuffer_pred_probs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_scores;
  __Pyx_Buffer __pyx_pybuffer_scores;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_optimal_targets", 0);
  __pyx_pybuffer_ans_points.pybuffer.buf = NULL;
  __pyx_pybuffer_ans_points.refcount = 0;
  __pyx_pybuffernd_ans_points.data = NULL;
  __pyx_pybuffernd_ans_points.rcbuffer = &__pyx_pybuffer_ans_points;
  __pyx_pybuffer_nxt_points.pybuffer.buf = NULL;
  __pyx_pybuffer_nxt_points.refcount = 0;
  __pyx_pybuffernd_nxt_points.data = NULL;
  __pyx_pybuffernd_nxt_points.rcbuffer = &__pyx_pybuffer_nxt_points;
  __pyx_pybuffer_pred_probs.pybuffer.buf = NULL;
  __pyx_pybuffer_pred_probs.refcount = 0;
  __pyx_pybuffernd_pred_probs.data = NULL;
  __pyx_pybuffernd_pred_probs.rcbuffer = &__pyx_pybuffer_pred_probs;
  __pyx_pybuffer_best_points.pybuffer.buf = NULL;
  __pyx_pybuffer_best_points.refcount = 0;
  __pyx_pybuffernd_best_points.data = NULL;
  __pyx_pybuffernd_best_points.rcbuffer = &__pyx_pybuffer_best_points;
  __pyx_pybuffer_goals_2D.pybuffer.buf = NULL;
  __pyx_pybuffer_goals_2D.refcount = 0;
  __pyx_pybuffernd_goals_2D.data = NULL;
  __pyx_pybuffernd_goals_2D.rcbuffer = &__pyx_pybuffer_goals_2D;
  __pyx_pybuffer_scores.pybuffer.buf = NULL;
  __pyx_pybuffer_scores.refcount = 0;
  __pyx_pybuffernd_scores.data = NULL;
  __pyx_pybuffernd_scores.rcbuffer = &__pyx_pybuffer_scores;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer, (PyObject*)__pyx_v_goals_2D, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 183, __pyx_L1_error)
  }
  __pyx_pybuffernd_goals_2D.diminfo[0].strides = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_goals_2D.diminfo[0].shape = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_goals_2D.diminfo[1].strides = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_goals_2D.diminfo[1].shape = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scores.rcbuffer->pybuffer, (PyObject*)__pyx_v_scores, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 183, __pyx_L1_error)
  }
  __pyx_pybuffernd_scores.diminfo[0].strides = __pyx_pybuffernd_scores.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scores.diminfo[0].shape = __pyx_pybuffernd_scores.rcbuffer->pybuffer.shape[0];
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ans_points.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_best_points.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nxt_points.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pred_probs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("utils_cython._get_optimal_targets", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ans_points.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_best_points.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nxt_points.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pred_probs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ans_points);
  __Pyx_XDECREF((PyObject *)__pyx_v_nxt_points);
  __Pyx_XDECREF((PyObject *)__pyx_v_pred_probs);
  __Pyx_XDECREF((PyObject *)__pyx_v_best_points);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__27 = PyTuple_Pack(34, __pyx_n_s_goals_2D, __pyx_n_s_scores, __pyx_n_s_file_name, __pyx_n_s_objective, __pyx_n_s_num_step, __pyx_n_s_cnt_sample, __pyx_n_s_MRratio, __pyx_n_s_opti_time, __pyx_n_s_kwargs, __pyx_n_s_t, __pyx_n_s_threshold, __pyx_n_s_expectation, __pyx_n_s_nxt_expectation, __pyx_n_s_lr, __pyx_n_s_ratio, __pyx_n_s_fire_prob, __pyx_n_s_min_expectation, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_n, __pyx_n_s_m, __pyx_n_s_t_int, __pyx_n_s_step, __pyx_n_s_op, __pyx_n_s_ok, __pyx_n_s_go, __pyx_n_s_ans_points, __pyx_n_s_nxt_points, __pyx_n_s_pred_probs, __pyx_n_s_best_expectation, __pyx_n_s_best_points, __pyx_n_s_start_time, __pyx_n_s_argmin, __pyx_n_s_k); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_13_get_optimal_targets, 0, __pyx_n_s_get_optimal_targets, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_optimal_targets, __pyx_t_2) < 0) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 34, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_get_optimal_targets, 183, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 183, __pyx_L1_error)
 184:                          file_name, objective, int num_step, int cnt_sample, MRratio, float opti_time, kwargs):
 185:     cdef np.float32_t t, threshold, expectation, nxt_expectation, lr, ratio, fire_prob, min_expectation
 186:     cdef int i, j, n, m, t_int, step, op, ok, go
+187:     n = goals_2D.shape[0]
  __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_goals_2D)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L1_error)
  __pyx_v_n = (__pyx_t_1[0]);
+188:     m = 0
  __pyx_v_m = 0;
+189:     threshold = 0.001
  __pyx_v_threshold = 0.001;
+190:     cdef np.ndarray[np.float32_t, ndim=2] ans_points = np.zeros((6, 2), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
  __pyx_tuple__10 = PyTuple_Pack(2, __pyx_int_6, __pyx_int_2); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__11, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 190, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ans_points.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_ans_points = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 190, __pyx_L1_error)
    } else {__pyx_pybuffernd_ans_points.diminfo[0].strides = __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ans_points.diminfo[0].shape = __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ans_points.diminfo[1].strides = __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ans_points.diminfo[1].shape = __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_ans_points = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_tuple__10); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);
+191:     cdef np.ndarray[np.float32_t, ndim=2] nxt_points = np.zeros((6, 2), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 191, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nxt_points.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_nxt_points = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 191, __pyx_L1_error)
    } else {__pyx_pybuffernd_nxt_points.diminfo[0].strides = __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nxt_points.diminfo[0].shape = __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nxt_points.diminfo[1].strides = __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nxt_points.diminfo[1].shape = __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_nxt_points = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
+192:     cdef np.ndarray[np.float32_t, ndim=1] pred_probs = np.zeros(6, dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__12, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 192, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pred_probs.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_pred_probs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_pred_probs.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 192, __pyx_L1_error)
    } else {__pyx_pybuffernd_pred_probs.diminfo[0].strides = __pyx_pybuffernd_pred_probs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pred_probs.diminfo[0].shape = __pyx_pybuffernd_pred_probs.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_pred_probs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
/* … */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_int_6); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
 193:     cdef:
+194:         float best_expectation = 10000.0
  __pyx_v_best_expectation = 10000.0;
+195:         np.ndarray[np.float32_t, ndim=2] best_points = np.zeros((6, 2), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__11, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 195, __pyx_L1_error)
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_best_points.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_best_points = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_best_points.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 195, __pyx_L1_error)
    } else {__pyx_pybuffernd_best_points.diminfo[0].strides = __pyx_pybuffernd_best_points.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_best_points.diminfo[0].shape = __pyx_pybuffernd_best_points.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_best_points.diminfo[1].strides = __pyx_pybuffernd_best_points.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_best_points.diminfo[1].shape = __pyx_pybuffernd_best_points.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_9 = 0;
  __pyx_v_best_points = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
 196: 
+197:     cdef float start_time = clock()
  __pyx_v_start_time = clock();
+198:     if opti_time < 100.0:
  __pyx_t_10 = (__pyx_v_opti_time < 100.0);
  if (__pyx_t_10) {
/* … */
  }
+199:         num_step = 1000_000
    __pyx_v_num_step = 0xF4240;
 200: 
+201:     for i in range(n):
  __pyx_t_11 = __pyx_v_n;
  __pyx_t_12 = __pyx_t_11;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;
+202:         if scores[i] >= threshold:
    __pyx_t_14 = __pyx_v_i;
    __pyx_t_10 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_scores.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_scores.diminfo[0].strides)) >= __pyx_v_threshold);
    if (__pyx_t_10) {
/* … */
    }
  }
+203:             goals_2D[m, 0] = goals_2D[i, 0]
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_15 = 0;
      __pyx_t_16 = __pyx_v_m;
      __pyx_t_17 = 0;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_goals_2D.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_goals_2D.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_goals_2D.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_goals_2D.diminfo[1].strides));
+204:             goals_2D[m, 1] = goals_2D[i, 1]
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_14 = 1;
      __pyx_t_17 = __pyx_v_m;
      __pyx_t_16 = 1;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_goals_2D.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_goals_2D.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_goals_2D.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_goals_2D.diminfo[1].strides));
+205:             scores[m] = scores[i]
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_15 = __pyx_v_m;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_scores.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_scores.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_scores.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_scores.diminfo[0].strides));
+206:             m += 1
      __pyx_v_m = (__pyx_v_m + 1);
+207:     if m == 0:
  __pyx_t_10 = (__pyx_v_m == 0);
  if (__pyx_t_10) {
/* … */
  }
+208:         print('warning: m == 0')
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* … */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_warning_m_0); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);
+209:         m = n
    __pyx_v_m = __pyx_v_n;
 210: 
+211:     n = m
  __pyx_v_n = __pyx_v_m;
 212: 
+213:     for j in range(6):
  for (__pyx_t_11 = 0; __pyx_t_11 < 6; __pyx_t_11+=1) {
    __pyx_v_j = __pyx_t_11;
+214:         t_int = get_rand_int(0, n - 1)
    __pyx_t_12 = __pyx_f_12utils_cython_get_rand_int(0, (__pyx_v_n - 1)); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L1_error)
    __pyx_v_t_int = __pyx_t_12;
+215:         ans_points[j, 0] = goals_2D[t_int, 0]
    __pyx_t_14 = __pyx_v_t_int;
    __pyx_t_15 = 0;
    __pyx_t_16 = __pyx_v_j;
    __pyx_t_17 = 0;
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_ans_points.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_ans_points.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_goals_2D.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_goals_2D.diminfo[1].strides));
+216:         ans_points[j, 1] = goals_2D[t_int, 1]
    __pyx_t_15 = __pyx_v_t_int;
    __pyx_t_14 = 1;
    __pyx_t_17 = __pyx_v_j;
    __pyx_t_16 = 1;
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_ans_points.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_ans_points.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_goals_2D.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_goals_2D.diminfo[1].strides));
  }
 217: 
+218:     expectation = get_value(goals_2D, scores, ans_points, n, objective, cnt_sample, MRratio, kwargs)
  __pyx_t_18 = __pyx_PyFloat_AsFloat(__pyx_v_MRratio); if (unlikely((__pyx_t_18 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error)
  __pyx_t_19 = __pyx_f_12utils_cython_get_value(((PyArrayObject *)__pyx_v_goals_2D), ((PyArrayObject *)__pyx_v_scores), ((PyArrayObject *)__pyx_v_ans_points), __pyx_v_n, __pyx_v_objective, __pyx_v_cnt_sample, __pyx_t_18, __pyx_v_kwargs); if (unlikely(__pyx_t_19 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error)
  __pyx_v_expectation = __pyx_t_19;
+219:     for step in range(num_step):
  __pyx_t_11 = __pyx_v_num_step;
  __pyx_t_12 = __pyx_t_11;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
    __pyx_v_step = __pyx_t_13;
+220:         if (clock() - start_time) / CLOCKS_PER_SEC >= opti_time:
    __pyx_t_20 = (clock() - __pyx_v_start_time);
    if (unlikely(CLOCKS_PER_SEC == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 220, __pyx_L1_error)
    }
    __pyx_t_10 = ((__pyx_t_20 / ((float)CLOCKS_PER_SEC)) >= __pyx_v_opti_time);
    if (__pyx_t_10) {
/* … */
    }
+221:             break
      goto __pyx_L11_break;
 222: 
+223:         ratio = step
    __pyx_v_ratio = __pyx_v_step;
+224:         ratio = ratio / num_step
    if (unlikely(__pyx_v_num_step == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 224, __pyx_L1_error)
    }
    __pyx_v_ratio = (__pyx_v_ratio / ((__pyx_t_5numpy_float32_t)__pyx_v_num_step));
 225: 
+226:         lr = exp(-(ratio * 2))
    __pyx_v_lr = exp((-(__pyx_v_ratio * 2.0)));
+227:         for j in range(6):
    for (__pyx_t_21 = 0; __pyx_t_21 < 6; __pyx_t_21+=1) {
      __pyx_v_j = __pyx_t_21;
+228:             nxt_points[j, 0] = ans_points[j, 0]
      __pyx_t_14 = __pyx_v_j;
      __pyx_t_15 = 0;
      __pyx_t_16 = __pyx_v_j;
      __pyx_t_17 = 0;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_nxt_points.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_ans_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_ans_points.diminfo[1].strides));
+229:             nxt_points[j, 1] = ans_points[j, 1]
      __pyx_t_15 = __pyx_v_j;
      __pyx_t_14 = 1;
      __pyx_t_17 = __pyx_v_j;
      __pyx_t_16 = 1;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_nxt_points.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_ans_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_ans_points.diminfo[1].strides));
    }
 230: 
+231:         op = get_rand_int(0, 0)
    __pyx_t_21 = __pyx_f_12utils_cython_get_rand_int(0, 0); if (unlikely(__pyx_t_21 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error)
    __pyx_v_op = __pyx_t_21;
+232:         if op == 0:
    __pyx_t_10 = (__pyx_v_op == 0);
    if (__pyx_t_10) {
/* … */
    }
+233:             while True:
      while (1) {
+234:                 ok = 0
        __pyx_v_ok = 0;
+235:                 for j in range(6):
        for (__pyx_t_21 = 0; __pyx_t_21 < 6; __pyx_t_21+=1) {
          __pyx_v_j = __pyx_t_21;
+236:                     if get_rand(0.0, 1.0) < 0.3:
          __pyx_t_19 = __pyx_f_12utils_cython_get_rand(0.0, 1.0); if (unlikely(__pyx_t_19 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L1_error)
          __pyx_t_10 = (__pyx_t_19 < 0.3);
          if (__pyx_t_10) {
/* … */
          }
        }
+237:                         nxt_points[j, 0] += get_rand(-lr, lr)
            __pyx_t_19 = __pyx_f_12utils_cython_get_rand((-__pyx_v_lr), __pyx_v_lr); if (unlikely(__pyx_t_19 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L1_error)
            __pyx_t_14 = __pyx_v_j;
            __pyx_t_15 = 0;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_nxt_points.diminfo[1].strides) += __pyx_t_19;
+238:                         nxt_points[j, 1] += get_rand(-lr, lr)
            __pyx_t_19 = __pyx_f_12utils_cython_get_rand((-__pyx_v_lr), __pyx_v_lr); if (unlikely(__pyx_t_19 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error)
            __pyx_t_15 = __pyx_v_j;
            __pyx_t_14 = 1;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_nxt_points.diminfo[1].strides) += __pyx_t_19;
+239:                         ok = 1
            __pyx_v_ok = 1;
+240:                 if ok:
        __pyx_t_10 = (__pyx_v_ok != 0);
        if (__pyx_t_10) {
/* … */
        }
      }
      __pyx_L17_break:;
+241:                     break
          goto __pyx_L17_break;
 242: 
+243:         nxt_expectation = get_value(goals_2D, scores, nxt_points, n, objective, cnt_sample, MRratio, kwargs)
    __pyx_t_19 = __pyx_PyFloat_AsFloat(__pyx_v_MRratio); if (unlikely((__pyx_t_19 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L1_error)
    __pyx_t_18 = __pyx_f_12utils_cython_get_value(((PyArrayObject *)__pyx_v_goals_2D), ((PyArrayObject *)__pyx_v_scores), ((PyArrayObject *)__pyx_v_nxt_points), __pyx_v_n, __pyx_v_objective, __pyx_v_cnt_sample, __pyx_t_19, __pyx_v_kwargs); if (unlikely(__pyx_t_18 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L1_error)
    __pyx_v_nxt_expectation = __pyx_t_18;
 244: 
+245:         go = 0
    __pyx_v_go = 0;
+246:         if nxt_expectation < expectation:
    __pyx_t_10 = (__pyx_v_nxt_expectation < __pyx_v_expectation);
    if (__pyx_t_10) {
/* … */
      goto __pyx_L22;
    }
+247:             go = 1
      __pyx_v_go = 1;
 248:         else:
+249:             fire_prob = 0.01
    /*else*/ {
      __pyx_v_fire_prob = 0.01;
+250:             if get_rand(0.0, 1.0) < fire_prob:
      __pyx_t_18 = __pyx_f_12utils_cython_get_rand(0.0, 1.0); if (unlikely(__pyx_t_18 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error)
      __pyx_t_10 = (__pyx_t_18 < __pyx_v_fire_prob);
      if (__pyx_t_10) {
/* … */
      }
    }
    __pyx_L22:;
+251:                 go = 1
        __pyx_v_go = 1;
 252: 
+253:         if go:
    __pyx_t_10 = (__pyx_v_go != 0);
    if (__pyx_t_10) {
/* … */
    }
+254:             expectation = nxt_expectation
      __pyx_v_expectation = __pyx_v_nxt_expectation;
+255:             for j in range(6):
      for (__pyx_t_21 = 0; __pyx_t_21 < 6; __pyx_t_21+=1) {
        __pyx_v_j = __pyx_t_21;
+256:                 ans_points[j, 0] = nxt_points[j, 0]
        __pyx_t_14 = __pyx_v_j;
        __pyx_t_15 = 0;
        __pyx_t_16 = __pyx_v_j;
        __pyx_t_17 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_ans_points.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_ans_points.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_nxt_points.diminfo[1].strides));
+257:                 ans_points[j, 1] = nxt_points[j, 1]
        __pyx_t_15 = __pyx_v_j;
        __pyx_t_14 = 1;
        __pyx_t_17 = __pyx_v_j;
        __pyx_t_16 = 1;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_ans_points.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_ans_points.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_nxt_points.diminfo[1].strides));
      }
 258: 
+259:         if expectation < best_expectation:
    __pyx_t_10 = (__pyx_v_expectation < __pyx_v_best_expectation);
    if (__pyx_t_10) {
/* … */
    }
  }
  __pyx_L11_break:;
+260:             best_expectation = expectation
      __pyx_v_best_expectation = __pyx_v_expectation;
+261:             for j in range(6):
      for (__pyx_t_21 = 0; __pyx_t_21 < 6; __pyx_t_21+=1) {
        __pyx_v_j = __pyx_t_21;
+262:                 best_points[j, 0], best_points[j, 1] = ans_points[j, 0], ans_points[j, 1]
        __pyx_t_14 = __pyx_v_j;
        __pyx_t_15 = 0;
        __pyx_t_18 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_ans_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_ans_points.diminfo[1].strides));
        __pyx_t_15 = __pyx_v_j;
        __pyx_t_14 = 1;
        __pyx_t_19 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_ans_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_ans_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_ans_points.diminfo[1].strides));
        __pyx_t_14 = __pyx_v_j;
        __pyx_t_15 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_best_points.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_best_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_best_points.diminfo[1].strides) = __pyx_t_18;
        __pyx_t_15 = __pyx_v_j;
        __pyx_t_14 = 1;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_best_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_best_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_best_points.diminfo[1].strides) = __pyx_t_19;
      }
 263: 
+264:     min_expectation = 10000.0
  __pyx_v_min_expectation = 10000.0;
+265:     argmin = 0
  __pyx_v_argmin = 0;
 266: 
+267:     for j in range(6):
  for (__pyx_t_11 = 0; __pyx_t_11 < 6; __pyx_t_11+=1) {
    __pyx_v_j = __pyx_t_11;
+268:         for k in range(6):
    for (__pyx_t_22 = 0; __pyx_t_22 < 6; __pyx_t_22+=1) {
      __pyx_v_k = __pyx_t_22;
+269:             nxt_points[k, 0], nxt_points[k, 1] = best_points[j, 0], best_points[j, 1]
      __pyx_t_14 = __pyx_v_j;
      __pyx_t_15 = 0;
      __pyx_t_19 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_best_points.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_best_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_best_points.diminfo[1].strides));
      __pyx_t_15 = __pyx_v_j;
      __pyx_t_14 = 1;
      __pyx_t_18 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_best_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_best_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_best_points.diminfo[1].strides));
      __pyx_t_14 = __pyx_v_k;
      __pyx_t_15 = 0;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_nxt_points.diminfo[1].strides) = __pyx_t_19;
      __pyx_t_15 = __pyx_v_k;
      __pyx_t_14 = 1;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_nxt_points.diminfo[1].strides) = __pyx_t_18;
    }
+270:         t = get_value(goals_2D, scores, nxt_points, n, 'minFDE', cnt_sample, MRratio, kwargs)
    __pyx_t_18 = __pyx_PyFloat_AsFloat(__pyx_v_MRratio); if (unlikely((__pyx_t_18 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error)
    __pyx_t_19 = __pyx_f_12utils_cython_get_value(((PyArrayObject *)__pyx_v_goals_2D), ((PyArrayObject *)__pyx_v_scores), ((PyArrayObject *)__pyx_v_nxt_points), __pyx_v_n, __pyx_n_u_minFDE, __pyx_v_cnt_sample, __pyx_t_18, __pyx_v_kwargs); if (unlikely(__pyx_t_19 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L1_error)
    __pyx_v_t = __pyx_t_19;
+271:         pred_probs[j] = 1.0 - get_value(goals_2D, scores, nxt_points, n, objective, cnt_sample, MRratio, kwargs)
    __pyx_t_19 = __pyx_PyFloat_AsFloat(__pyx_v_MRratio); if (unlikely((__pyx_t_19 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error)
    __pyx_t_18 = __pyx_f_12utils_cython_get_value(((PyArrayObject *)__pyx_v_goals_2D), ((PyArrayObject *)__pyx_v_scores), ((PyArrayObject *)__pyx_v_nxt_points), __pyx_v_n, __pyx_v_objective, __pyx_v_cnt_sample, __pyx_t_19, __pyx_v_kwargs); if (unlikely(__pyx_t_18 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L1_error)
    __pyx_t_14 = __pyx_v_j;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_pred_probs.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_pred_probs.diminfo[0].strides) = (1.0 - __pyx_t_18);
+272:         if t < min_expectation:
    __pyx_t_10 = (__pyx_v_t < __pyx_v_min_expectation);
    if (__pyx_t_10) {
/* … */
    }
  }
+273:             min_expectation = t
      __pyx_v_min_expectation = __pyx_v_t;
+274:             argmin = j
      __pyx_v_argmin = __pyx_v_j;
 275: 
+276:     return best_expectation, best_points, argmin, pred_probs
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_best_expectation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_argmin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_INCREF((PyObject *)__pyx_v_best_points);
  __Pyx_GIVEREF((PyObject *)__pyx_v_best_points);
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_best_points));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_INCREF((PyObject *)__pyx_v_pred_probs);
  __Pyx_GIVEREF((PyObject *)__pyx_v_pred_probs);
  PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_v_pred_probs));
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;
 277: 
+278: def get_optimal_targets(goals_2D, scores, file_name, objective, opti_time, kwargs: dict = None):
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_15get_optimal_targets(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_15get_optimal_targets = {"get_optimal_targets", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_15get_optimal_targets, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_15get_optimal_targets(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_goals_2D = 0;
  PyObject *__pyx_v_scores = 0;
  PyObject *__pyx_v_file_name = 0;
  PyObject *__pyx_v_objective = 0;
  PyObject *__pyx_v_opti_time = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_optimal_targets (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_goals_2D,&__pyx_n_s_scores,&__pyx_n_s_file_name,&__pyx_n_s_objective,&__pyx_n_s_opti_time,&__pyx_n_s_kwargs,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[5] = ((PyObject*)((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_goals_2D)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_scores)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_optimal_targets", 0, 5, 6, 1); __PYX_ERR(0, 278, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file_name)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_optimal_targets", 0, 5, 6, 2); __PYX_ERR(0, 278, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_objective)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_optimal_targets", 0, 5, 6, 3); __PYX_ERR(0, 278, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_opti_time)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_optimal_targets", 0, 5, 6, 4); __PYX_ERR(0, 278, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kwargs);
          if (value) { values[5] = value; kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 278, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_optimal_targets") < 0)) __PYX_ERR(0, 278, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_goals_2D = values[0];
    __pyx_v_scores = values[1];
    __pyx_v_file_name = values[2];
    __pyx_v_objective = values[3];
    __pyx_v_opti_time = values[4];
    __pyx_v_kwargs = ((PyObject*)values[5]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_optimal_targets", 0, 5, 6, __pyx_nargs); __PYX_ERR(0, 278, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython.get_optimal_targets", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(0, 278, __pyx_L1_error)
  __pyx_r = __pyx_pf_12utils_cython_14get_optimal_targets(__pyx_self, __pyx_v_goals_2D, __pyx_v_scores, __pyx_v_file_name, __pyx_v_objective, __pyx_v_opti_time, __pyx_v_kwargs);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_14get_optimal_targets(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_goals_2D, PyObject *__pyx_v_scores, PyObject *__pyx_v_file_name, PyObject *__pyx_v_objective, PyObject *__pyx_v_opti_time, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_MRratio = NULL;
  PyObject *__pyx_v_cnt_sample = NULL;
  PyObject *__pyx_v_num_step = NULL;
  PyObject *__pyx_v_expectation = NULL;
  PyObject *__pyx_v_ans_points = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_argmin = NULL;
  PyObject *__pyx_v_pred_probs = NULL;
  PyObject *__pyx_v_argsort = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_optimal_targets", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("utils_cython.get_optimal_targets", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_MRratio);
  __Pyx_XDECREF(__pyx_v_cnt_sample);
  __Pyx_XDECREF(__pyx_v_num_step);
  __Pyx_XDECREF(__pyx_v_expectation);
  __Pyx_XDECREF(__pyx_v_ans_points);
  __Pyx_XDECREF(__pyx_v_argmin);
  __Pyx_XDECREF(__pyx_v_pred_probs);
  __Pyx_XDECREF(__pyx_v_argsort);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__29 = PyTuple_Pack(14, __pyx_n_s_goals_2D, __pyx_n_s_scores, __pyx_n_s_file_name, __pyx_n_s_objective, __pyx_n_s_opti_time, __pyx_n_s_kwargs, __pyx_n_s_MRratio, __pyx_n_s_cnt_sample, __pyx_n_s_num_step, __pyx_n_s_expectation, __pyx_n_s_ans_points, __pyx_n_s_argmin, __pyx_n_s_pred_probs, __pyx_n_s_argsort); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_get_optimal_targets_2, 278, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 278, __pyx_L1_error)
/* … */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_kwargs, __pyx_n_s_dict) < 0) __PYX_ERR(0, 278, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_15get_optimal_targets, 0, __pyx_n_s_get_optimal_targets_2, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__31);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_optimal_targets_2, __pyx_t_3) < 0) __PYX_ERR(0, 278, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_tuple__31 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);
+279:     MRratio = kwargs.get('MRratio', 1.0)
  if (unlikely(__pyx_v_kwargs == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
    __PYX_ERR(0, 279, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_u_MRratio, __pyx_float_1_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_MRratio = __pyx_t_1;
  __pyx_t_1 = 0;
+280:     cnt_sample = kwargs.get('cnt_sample', 2)
  if (unlikely(__pyx_v_kwargs == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
    __PYX_ERR(0, 280, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_u_cnt_sample, __pyx_int_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cnt_sample = __pyx_t_1;
  __pyx_t_1 = 0;
+281:     num_step = kwargs.get('num_step', 4000)
  if (unlikely(__pyx_v_kwargs == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
    __PYX_ERR(0, 281, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_u_num_step, __pyx_int_4000); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_num_step = __pyx_t_1;
  __pyx_t_1 = 0;
+282:     expectation, ans_points, argmin, pred_probs = _get_optimal_targets(goals_2D, scores, file_name, objective, num_step, cnt_sample,
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_optimal_targets); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
/* … */
  __pyx_v_expectation = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_ans_points = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_argmin = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_pred_probs = __pyx_t_6;
  __pyx_t_6 = 0;
+283:                                                                        MRratio, opti_time, kwargs)
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[10] = {__pyx_t_3, __pyx_v_goals_2D, __pyx_v_scores, __pyx_v_file_name, __pyx_v_objective, __pyx_v_num_step, __pyx_v_cnt_sample, __pyx_v_MRratio, __pyx_v_opti_time, __pyx_v_kwargs};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 9+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 282, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_5,&__pyx_t_6};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 282, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_5,&__pyx_t_6};
    __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < 0) __PYX_ERR(0, 282, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 282, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
+284:     argsort = np.argsort(-pred_probs)
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_argsort); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Negative(__pyx_v_pred_probs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_v_argsort = __pyx_t_1;
  __pyx_t_1 = 0;
+285:     ans_points = ans_points[argsort]
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_ans_points, __pyx_v_argsort); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_ans_points, __pyx_t_1);
  __pyx_t_1 = 0;
+286:     pred_probs = pred_probs[argsort]
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_pred_probs, __pyx_v_argsort); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pred_probs, __pyx_t_1);
  __pyx_t_1 = 0;
 287:     # TODO
 288:     # ans_points[0, 0], ans_points[argmin, 0] = ans_points[argmin, 0], ans_points[0, 0]
 289:     # ans_points[0, 1], ans_points[argmin, 1] = ans_points[argmin, 1], ans_points[0, 1]
+290:     return expectation, ans_points, pred_probs
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_expectation);
  __Pyx_GIVEREF(__pyx_v_expectation);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_expectation);
  __Pyx_INCREF(__pyx_v_ans_points);
  __Pyx_GIVEREF(__pyx_v_ans_points);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ans_points);
  __Pyx_INCREF(__pyx_v_pred_probs);
  __Pyx_GIVEREF(__pyx_v_pred_probs);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_pred_probs);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 291: 
+292: def _get_normalized(np.ndarray[np.float32_t, ndim=3] polygons, np.float32_t x, np.float32_t y, np.float32_t angle):
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_17_get_normalized(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_17_get_normalized = {"_get_normalized", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_17_get_normalized, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_17_get_normalized(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyArrayObject *__pyx_v_polygons = 0;
  __pyx_t_5numpy_float32_t __pyx_v_x;
  __pyx_t_5numpy_float32_t __pyx_v_y;
  __pyx_t_5numpy_float32_t __pyx_v_angle;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_normalized (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_polygons,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_angle,0};
    PyObject* values[4] = {0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_polygons)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_normalized", 1, 4, 4, 1); __PYX_ERR(0, 292, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_y)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_normalized", 1, 4, 4, 2); __PYX_ERR(0, 292, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_angle)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_get_normalized", 1, 4, 4, 3); __PYX_ERR(0, 292, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_get_normalized") < 0)) __PYX_ERR(0, 292, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 4)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
    }
    __pyx_v_polygons = ((PyArrayObject *)values[0]);
    __pyx_v_x = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_x == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error)
    __pyx_v_y = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_y == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error)
    __pyx_v_angle = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_angle == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_normalized", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 292, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython._get_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_polygons), __pyx_ptype_5numpy_ndarray, 1, "polygons", 0))) __PYX_ERR(0, 292, __pyx_L1_error)
  __pyx_r = __pyx_pf_12utils_cython_16_get_normalized(__pyx_self, __pyx_v_polygons, __pyx_v_x, __pyx_v_y, __pyx_v_angle);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_16_get_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_polygons, __pyx_t_5numpy_float32_t __pyx_v_x, __pyx_t_5numpy_float32_t __pyx_v_y, __pyx_t_5numpy_float32_t __pyx_v_angle) {
  __pyx_t_5numpy_float32_t __pyx_v_cos_;
  __pyx_t_5numpy_float32_t __pyx_v_sin_;
  int __pyx_v_i;
  int __pyx_v_n;
  int __pyx_v_polygon_idx;
  PyArrayObject *__pyx_v_new_polygons = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new_polygons;
  __Pyx_Buffer __pyx_pybuffer_new_polygons;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_polygons;
  __Pyx_Buffer __pyx_pybuffer_polygons;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_normalized", 0);
  __pyx_pybuffer_new_polygons.pybuffer.buf = NULL;
  __pyx_pybuffer_new_polygons.refcount = 0;
  __pyx_pybuffernd_new_polygons.data = NULL;
  __pyx_pybuffernd_new_polygons.rcbuffer = &__pyx_pybuffer_new_polygons;
  __pyx_pybuffer_polygons.pybuffer.buf = NULL;
  __pyx_pybuffer_polygons.refcount = 0;
  __pyx_pybuffernd_polygons.data = NULL;
  __pyx_pybuffernd_polygons.rcbuffer = &__pyx_pybuffer_polygons;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_polygons.rcbuffer->pybuffer, (PyObject*)__pyx_v_polygons, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 292, __pyx_L1_error)
  }
  __pyx_pybuffernd_polygons.diminfo[0].strides = __pyx_pybuffernd_polygons.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_polygons.diminfo[0].shape = __pyx_pybuffernd_polygons.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_polygons.diminfo[1].strides = __pyx_pybuffernd_polygons.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_polygons.diminfo[1].shape = __pyx_pybuffernd_polygons.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_polygons.diminfo[2].strides = __pyx_pybuffernd_polygons.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_polygons.diminfo[2].shape = __pyx_pybuffernd_polygons.rcbuffer->pybuffer.shape[2];
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new_polygons.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_polygons.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("utils_cython._get_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new_polygons.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_polygons.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_new_polygons);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__32 = PyTuple_Pack(12, __pyx_n_s_polygons, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_angle, __pyx_n_s_cos, __pyx_n_s_sin, __pyx_n_s_min_sqr_dis, __pyx_n_s_temp, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_polygon_idx, __pyx_n_s_new_polygons); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);
/* … */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_17_get_normalized, 0, __pyx_n_s_get_normalized, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_normalized, __pyx_t_3) < 0) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_get_normalized, 292, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 292, __pyx_L1_error)
 293:     cdef:
 294:         np.float32_t cos_, sin_, min_sqr_dis, temp
 295:         int i, n, polygon_idx
+296:     cos_ = cos(angle)
  __pyx_v_cos_ = cos(__pyx_v_angle);
+297:     sin_ = sin(angle)
  __pyx_v_sin_ = sin(__pyx_v_angle);
+298:     n = polygons.shape[1]
  __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_polygons)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L1_error)
  __pyx_v_n = (__pyx_t_1[1]);
+299:     cdef np.ndarray[np.float32_t, ndim=3] new_polygons = np.zeros((polygons.shape[0], n, 2), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_polygons)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_1[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_2);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 299, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new_polygons.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {
      __pyx_v_new_polygons = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_new_polygons.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 299, __pyx_L1_error)
    } else {__pyx_pybuffernd_new_polygons.diminfo[0].strides = __pyx_pybuffernd_new_polygons.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new_polygons.diminfo[0].shape = __pyx_pybuffernd_new_polygons.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_new_polygons.diminfo[1].strides = __pyx_pybuffernd_new_polygons.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_new_polygons.diminfo[1].shape = __pyx_pybuffernd_new_polygons.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_new_polygons.diminfo[2].strides = __pyx_pybuffernd_new_polygons.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_new_polygons.diminfo[2].shape = __pyx_pybuffernd_new_polygons.rcbuffer->pybuffer.shape[2];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_new_polygons = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;
+300:     for polygon_idx in range(polygons.shape[0]):
  __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_polygons)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 300, __pyx_L1_error)
  __pyx_t_8 = (__pyx_t_1[0]);
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_polygon_idx = __pyx_t_10;
+301:         for i in range(n):
    __pyx_t_11 = __pyx_v_n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;
+302:             polygons[polygon_idx, i, 0] -= x
      __pyx_t_14 = __pyx_v_polygon_idx;
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = 0;
      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_polygons.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_polygons.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_polygons.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_polygons.diminfo[2].strides) -= __pyx_v_x;
+303:             polygons[polygon_idx, i, 1] -= y
      __pyx_t_16 = __pyx_v_polygon_idx;
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_14 = 1;
      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_polygons.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_polygons.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_polygons.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_polygons.diminfo[2].strides) -= __pyx_v_y;
+304:             new_polygons[polygon_idx, i, 0] = polygons[polygon_idx, i, 0] * cos_ - polygons[polygon_idx, i, 1] * sin_
      __pyx_t_14 = __pyx_v_polygon_idx;
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = 0;
      __pyx_t_17 = __pyx_v_polygon_idx;
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_19 = 1;
      __pyx_t_20 = __pyx_v_polygon_idx;
      __pyx_t_21 = __pyx_v_i;
      __pyx_t_22 = 0;
      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_new_polygons.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_new_polygons.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_new_polygons.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_new_polygons.diminfo[2].strides) = (((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_polygons.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_polygons.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_polygons.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_polygons.diminfo[2].strides)) * __pyx_v_cos_) - ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_polygons.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_polygons.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_polygons.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_polygons.diminfo[2].strides)) * __pyx_v_sin_));
+305:             new_polygons[polygon_idx, i, 1] = polygons[polygon_idx, i, 0] * sin_ + polygons[polygon_idx, i, 1] * cos_
      __pyx_t_19 = __pyx_v_polygon_idx;
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_17 = 0;
      __pyx_t_16 = __pyx_v_polygon_idx;
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_14 = 1;
      __pyx_t_22 = __pyx_v_polygon_idx;
      __pyx_t_21 = __pyx_v_i;
      __pyx_t_20 = 1;
      *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_new_polygons.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_new_polygons.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_new_polygons.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_new_polygons.diminfo[2].strides) = (((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_polygons.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_polygons.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_polygons.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_polygons.diminfo[2].strides)) * __pyx_v_sin_) + ((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_polygons.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_polygons.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_polygons.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_polygons.diminfo[2].strides)) * __pyx_v_cos_));
    }
  }
+306:     return new_polygons
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_new_polygons);
  __pyx_r = ((PyObject *)__pyx_v_new_polygons);
  goto __pyx_L0;
 307: 
+308: def get_normalized(trajectorys, normalizer, reverse=False):
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_19get_normalized(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_19get_normalized = {"get_normalized", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_19get_normalized, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_19get_normalized(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_trajectorys = 0;
  PyObject *__pyx_v_normalizer = 0;
  PyObject *__pyx_v_reverse = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_normalized (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_trajectorys,&__pyx_n_s_normalizer,&__pyx_n_s_reverse,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_False));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_trajectorys)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_normalizer)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_normalized", 0, 2, 3, 1); __PYX_ERR(0, 308, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reverse);
          if (value) { values[2] = value; kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_normalized") < 0)) __PYX_ERR(0, 308, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_trajectorys = values[0];
    __pyx_v_normalizer = values[1];
    __pyx_v_reverse = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_normalized", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 308, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython.get_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12utils_cython_18get_normalized(__pyx_self, __pyx_v_trajectorys, __pyx_v_normalizer, __pyx_v_reverse);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_18get_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_trajectorys, PyObject *__pyx_v_normalizer, PyObject *__pyx_v_reverse) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_normalized", 0);
  __Pyx_INCREF(__pyx_v_trajectorys);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("utils_cython.get_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_trajectorys);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__34 = PyTuple_Pack(3, __pyx_n_s_trajectorys, __pyx_n_s_normalizer, __pyx_n_s_reverse); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);
  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_get_normalized_2, 308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 308, __pyx_L1_error)
/* … */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_19get_normalized, 0, __pyx_n_s_get_normalized_2, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__36);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_normalized_2, __pyx_t_3) < 0) __PYX_ERR(0, 308, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_tuple__36 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);
+309:     if trajectorys.dtype is not np.float32:
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_trajectorys, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_1 != __pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {
/* … */
  }
+310:         trajectorys = trajectorys.astype(np.float32)
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_trajectorys, __pyx_n_s_astype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_6 = 1;
      }
    }
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF_SET(__pyx_v_trajectorys, __pyx_t_3);
    __pyx_t_3 = 0;
 311: 
+312:     if reverse:
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_reverse); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 312, __pyx_L1_error)
  if (__pyx_t_4) {
/* … */
  }
+313:         return _get_normalized(trajectorys, normalizer.origin[0], normalizer.origin[1], -normalizer.yaw)
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_get_normalized); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_origin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_origin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_yaw); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PyNumber_Negative(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_6 = 1;
      }
    }
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_5, __pyx_v_trajectorys, __pyx_t_2, __pyx_t_7, __pyx_t_8};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 4+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
+314:     return _get_normalized(trajectorys, normalizer.x, normalizer.y, normalizer.yaw)
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_get_normalized); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_x); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_y); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_yaw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_6 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_5, __pyx_v_trajectorys, __pyx_t_8, __pyx_t_7, __pyx_t_2};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 4+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;
 315: 
+316: def get_normalized_points(points: np.ndarray, normalizer, reverse=False):
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_21get_normalized_points(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_21get_normalized_points = {"get_normalized_points", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_21get_normalized_points, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_21get_normalized_points(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyArrayObject *__pyx_v_points = 0;
  PyObject *__pyx_v_normalizer = 0;
  PyObject *__pyx_v_reverse = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_normalized_points (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_normalizer,&__pyx_n_s_reverse,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_False));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_points)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 316, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_normalizer)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 316, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("get_normalized_points", 0, 2, 3, 1); __PYX_ERR(0, 316, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reverse);
          if (value) { values[2] = value; kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 316, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_normalized_points") < 0)) __PYX_ERR(0, 316, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_points = ((PyArrayObject *)values[0]);
    __pyx_v_normalizer = values[1];
    __pyx_v_reverse = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_normalized_points", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 316, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython.get_normalized_points", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_points), __pyx_ptype_5numpy_ndarray, 0, "points", 0))) __PYX_ERR(0, 316, __pyx_L1_error)
  __pyx_r = __pyx_pf_12utils_cython_20get_normalized_points(__pyx_self, __pyx_v_points, __pyx_v_normalizer, __pyx_v_reverse);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_20get_normalized_points(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_points, PyObject *__pyx_v_normalizer, PyObject *__pyx_v_reverse) {
  PyObject *__pyx_v_trajectorys = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_normalized_points", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_points);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("utils_cython.get_normalized_points", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_trajectorys);
  __Pyx_XDECREF((PyObject *)__pyx_v_points);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__37 = PyTuple_Pack(4, __pyx_n_s_points, __pyx_n_s_normalizer, __pyx_n_s_reverse, __pyx_n_s_trajectorys); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);
  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_get_normalized_points, 316, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 316, __pyx_L1_error)
/* … */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_points, __pyx_kp_s_np_ndarray) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_21get_normalized_points, 0, __pyx_n_s_get_normalized_points, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__39);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_normalized_points, __pyx_t_2) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_tuple__39 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);
+317:     if points.dtype is not np.float32:
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_points), __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_1 != __pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {
/* … */
  }
+318:         points = points.astype(np.float32)
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_points), __pyx_n_s_astype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_6 = 1;
      }
    }
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_points, ((PyArrayObject *)__pyx_t_3));
    __pyx_t_3 = 0;
 319: 
+320:     trajectorys = points[np.newaxis, :]
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_newaxis); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_slice__3);
  __Pyx_GIVEREF(__pyx_slice__3);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__3);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_points), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_trajectorys = __pyx_t_1;
  __pyx_t_1 = 0;
+321:     if reverse:
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_reverse); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 321, __pyx_L1_error)
  if (__pyx_t_4) {
/* … */
  }
+322:         return _get_normalized(trajectorys, normalizer.origin[0], normalizer.origin[1], -normalizer.yaw)[0]
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_normalized); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_origin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_origin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_yaw); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PyNumber_Negative(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_5, __pyx_v_trajectorys, __pyx_t_2, __pyx_t_7, __pyx_t_8};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 4+__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
+323:     return _get_normalized(trajectorys, normalizer.x, normalizer.y, normalizer.yaw)[0]
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_get_normalized); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_x); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_y); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalizer, __pyx_n_s_yaw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_6 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[5] = {__pyx_t_5, __pyx_v_trajectorys, __pyx_t_8, __pyx_t_7, __pyx_t_2};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 4+__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 324: 
+325: cdef float _set_predict_get_value(np.ndarray[np.float32_t, ndim=2] goals_2D,
static float __pyx_f_12utils_cython__set_predict_get_value(PyArrayObject *__pyx_v_goals_2D, PyArrayObject *__pyx_v_scores, PyArrayObject *__pyx_v_selected_points, PyObject *__pyx_v_kwargs) {
  int __pyx_v_n;
  PyArrayObject *__pyx_v_point = 0;
  float __pyx_v_MRratio;
  float __pyx_v_value;
  float __pyx_v_x;
  float __pyx_v_y;
  float __pyx_v_sum;
  float __pyx_v_minFDE;
  float __pyx_v_t_float;
  float __pyx_v_miss_error;
  float __pyx_v_stride;
  float __pyx_v_s_x;
  float __pyx_v_s_y;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_cnt;
  int __pyx_v_t_int;
  int __pyx_v_cnt_len;
  int __pyx_v_a;
  int __pyx_v_b;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_goals_2D;
  __Pyx_Buffer __pyx_pybuffer_goals_2D;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_point;
  __Pyx_Buffer __pyx_pybuffer_point;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_scores;
  __Pyx_Buffer __pyx_pybuffer_scores;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_selected_points;
  __Pyx_Buffer __pyx_pybuffer_selected_points;
  float __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_predict_get_value", 0);
  __pyx_pybuffer_point.pybuffer.buf = NULL;
  __pyx_pybuffer_point.refcount = 0;
  __pyx_pybuffernd_point.data = NULL;
  __pyx_pybuffernd_point.rcbuffer = &__pyx_pybuffer_point;
  __pyx_pybuffer_goals_2D.pybuffer.buf = NULL;
  __pyx_pybuffer_goals_2D.refcount = 0;
  __pyx_pybuffernd_goals_2D.data = NULL;
  __pyx_pybuffernd_goals_2D.rcbuffer = &__pyx_pybuffer_goals_2D;
  __pyx_pybuffer_scores.pybuffer.buf = NULL;
  __pyx_pybuffer_scores.refcount = 0;
  __pyx_pybuffernd_scores.data = NULL;
  __pyx_pybuffernd_scores.rcbuffer = &__pyx_pybuffer_scores;
  __pyx_pybuffer_selected_points.pybuffer.buf = NULL;
  __pyx_pybuffer_selected_points.refcount = 0;
  __pyx_pybuffernd_selected_points.data = NULL;
  __pyx_pybuffernd_selected_points.rcbuffer = &__pyx_pybuffer_selected_points;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer, (PyObject*)__pyx_v_goals_2D, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 325, __pyx_L1_error)
  }
  __pyx_pybuffernd_goals_2D.diminfo[0].strides = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_goals_2D.diminfo[0].shape = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_goals_2D.diminfo[1].strides = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_goals_2D.diminfo[1].shape = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scores.rcbuffer->pybuffer, (PyObject*)__pyx_v_scores, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 325, __pyx_L1_error)
  }
  __pyx_pybuffernd_scores.diminfo[0].strides = __pyx_pybuffernd_scores.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scores.diminfo[0].shape = __pyx_pybuffernd_scores.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selected_points.rcbuffer->pybuffer, (PyObject*)__pyx_v_selected_points, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 325, __pyx_L1_error)
  }
  __pyx_pybuffernd_selected_points.diminfo[0].strides = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selected_points.diminfo[0].shape = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selected_points.diminfo[1].strides = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selected_points.diminfo[1].shape = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.shape[1];
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_point.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selected_points.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("utils_cython._set_predict_get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_point.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selected_points.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_point);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 326:                                   np.ndarray[np.float32_t, ndim=1] scores,
 327:                                   np.ndarray[np.float32_t, ndim=2] selected_points,
 328:                                   kwargs):
 329:     cdef:
+330:         int n = goals_2D.shape[0]
  __pyx_t_1 = __pyx_f_5numpy_7ndarray_5shape_shape(((PyArrayObject *)__pyx_v_goals_2D)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 330, __pyx_L1_error)
  __pyx_v_n = (__pyx_t_1[0]);
+331:         np.ndarray[np.float32_t, ndim=1] point = np.zeros(2, dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__9, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 331, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_point.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_point = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_point.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 331, __pyx_L1_error)
    } else {__pyx_pybuffernd_point.diminfo[0].strides = __pyx_pybuffernd_point.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_point.diminfo[0].shape = __pyx_pybuffernd_point.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_point = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
+332:         float MRratio = 1.0
  __pyx_v_MRratio = 1.0;
 333: 
+334:         float value = 0.0, cnt_hit, x, y, sum, minFDE, t_float, miss_error, stride, s_x, s_y
  __pyx_v_value = 0.0;
+335:         int i, j, k, need, cnt, t_int, objective_int, cnt_len = 3, a, b
  __pyx_v_cnt_len = 3;
 336: 
+337:     if kwargs is not None and 'set_predict-MRratio' in kwargs:
  __pyx_t_8 = (__pyx_v_kwargs != Py_None);
  if (__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_set_predict_MRratio, __pyx_v_kwargs, Py_EQ)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 337, __pyx_L1_error)
  __pyx_t_7 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_7) {
/* … */
  }
+338:         MRratio = float(kwargs['set_predict-MRratio'])
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_kwargs, __pyx_kp_u_set_predict_MRratio); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_AsDouble(__pyx_t_5); if (unlikely(__pyx_t_9 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_MRratio = __pyx_t_9;
 339: 
+340:     for i in range(n):
  __pyx_t_10 = __pyx_v_n;
  __pyx_t_11 = __pyx_t_10;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;
+341:         point[0], point[1] = goals_2D[i, 0], goals_2D[i, 1]
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_14 = 0;
    __pyx_t_15 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_goals_2D.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_goals_2D.diminfo[1].strides));
    __pyx_t_14 = __pyx_v_i;
    __pyx_t_13 = 1;
    __pyx_t_16 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_goals_2D.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_goals_2D.diminfo[1].strides));
    __pyx_t_13 = 0;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_point.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_point.diminfo[0].strides) = __pyx_t_15;
    __pyx_t_13 = 1;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_point.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_point.diminfo[0].strides) = __pyx_t_16;
 342: 
 343:         if True:
+344:             sum = 0.0
    __pyx_v_sum = 0.0;
+345:             t_int = int(scores[i] * 1000)
    __pyx_t_13 = __pyx_v_i;
    __pyx_v_t_int = ((int)((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_scores.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_scores.diminfo[0].strides)) * 1000.0));
 346: 
+347:             if t_int > 10:
    __pyx_t_7 = (__pyx_v_t_int > 10);
    if (__pyx_t_7) {
/* … */
      goto __pyx_L8;
    }
+348:                 cnt = cnt_len * 3
      __pyx_v_cnt = (__pyx_v_cnt_len * 3);
+349:             elif t_int > 5:
    __pyx_t_7 = (__pyx_v_t_int > 5);
    if (__pyx_t_7) {
/* … */
      goto __pyx_L8;
    }
+350:                 cnt = cnt_len * 2
      __pyx_v_cnt = (__pyx_v_cnt_len * 2);
 351:             else:
+352:                 cnt = cnt_len
    /*else*/ {
      __pyx_v_cnt = __pyx_v_cnt_len;
    }
    __pyx_L8:;
 353: 
+354:             t_float = cnt
    __pyx_v_t_float = __pyx_v_cnt;
+355:             stride = 1.0 / t_float
    if (unlikely(__pyx_v_t_float == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 355, __pyx_L1_error)
    }
    __pyx_v_stride = (1.0 / ((double)__pyx_v_t_float));
 356: 
+357:             s_x = point[0] - 0.5 + stride / 2.0
    __pyx_t_13 = 0;
    __pyx_v_s_x = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_point.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_point.diminfo[0].strides)) - 0.5) + (((double)__pyx_v_stride) / 2.0));
+358:             s_y = point[1] - 0.5 + stride / 2.0
    __pyx_t_13 = 1;
    __pyx_v_s_y = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_point.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_point.diminfo[0].strides)) - 0.5) + (((double)__pyx_v_stride) / 2.0));
 359: 
+360:             for a in range(cnt):
    __pyx_t_17 = __pyx_v_cnt;
    __pyx_t_18 = __pyx_t_17;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_a = __pyx_t_19;
+361:                 for b in range(cnt):
      __pyx_t_20 = __pyx_v_cnt;
      __pyx_t_21 = __pyx_t_20;
      for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
        __pyx_v_b = __pyx_t_22;
 362:                     # x = get_rand(point[0] - 0.5, point[0] + 0.5)
 363:                     # y = get_rand(point[1] - 0.5, point[1] + 0.5)
+364:                     x = s_x + a * stride
        __pyx_v_x = (__pyx_v_s_x + (__pyx_v_a * __pyx_v_stride));
+365:                     y = s_y + b * stride
        __pyx_v_y = (__pyx_v_s_y + (__pyx_v_b * __pyx_v_stride));
+366:                     minFDE = 10000.0
        __pyx_v_minFDE = 10000.0;
+367:                     miss_error = 1.0
        __pyx_v_miss_error = 1.0;
 368:                     # warning: miss_error is not 10.0
+369:                     for j in range(6):
        for (__pyx_t_23 = 0; __pyx_t_23 < 6; __pyx_t_23+=1) {
          __pyx_v_j = __pyx_t_23;
+370:                         t_float = get_dis_point(x - selected_points[j, 0], y - selected_points[j, 1])
          __pyx_t_13 = __pyx_v_j;
          __pyx_t_14 = 0;
          __pyx_t_24 = __pyx_v_j;
          __pyx_t_25 = 1;
          __pyx_t_16 = __pyx_f_12utils_cython_get_dis_point((__pyx_v_x - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_selected_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_selected_points.diminfo[1].strides))), (__pyx_v_y - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_selected_points.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_selected_points.diminfo[1].strides)))); if (unlikely(__pyx_t_16 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 370, __pyx_L1_error)
          __pyx_v_t_float = __pyx_t_16;
+371:                         if t_float < minFDE:
          __pyx_t_7 = (__pyx_v_t_float < __pyx_v_minFDE);
          if (__pyx_t_7) {
/* … */
          }
        }
+372:                             minFDE = t_float
            __pyx_v_minFDE = __pyx_v_t_float;
+373:                     if minFDE <= 2.0:
        __pyx_t_7 = (__pyx_v_minFDE <= 2.0);
        if (__pyx_t_7) {
/* … */
        }
+374:                         miss_error = 0.0
          __pyx_v_miss_error = 0.0;
+375:                     sum += minFDE * (1.0 - MRratio) + miss_error * MRratio
        __pyx_v_sum = (__pyx_v_sum + ((__pyx_v_minFDE * (1.0 - __pyx_v_MRratio)) + (__pyx_v_miss_error * __pyx_v_MRratio)));
      }
    }
+376:             sum /= cnt * cnt
    __pyx_t_17 = (__pyx_v_cnt * __pyx_v_cnt);
    if (unlikely(__pyx_t_17 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 376, __pyx_L1_error)
    }
    __pyx_v_sum = (__pyx_v_sum / __pyx_t_17);
+377:             value += scores[i] * sum
    __pyx_t_25 = __pyx_v_i;
    __pyx_v_value = (__pyx_v_value + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_scores.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_scores.diminfo[0].strides)) * __pyx_v_sum));
  }
 378: 
+379:     return value
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;
 380: 
+381: def set_predict_get_value(goals_2D, scores, selected_points, kwargs=None):
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_23set_predict_get_value(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_23set_predict_get_value = {"set_predict_get_value", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_23set_predict_get_value, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_23set_predict_get_value(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_goals_2D = 0;
  PyObject *__pyx_v_scores = 0;
  PyObject *__pyx_v_selected_points = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_predict_get_value (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_goals_2D,&__pyx_n_s_scores,&__pyx_n_s_selected_points,&__pyx_n_s_kwargs,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_goals_2D)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_scores)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("set_predict_get_value", 0, 3, 4, 1); __PYX_ERR(0, 381, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_selected_points)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("set_predict_get_value", 0, 3, 4, 2); __PYX_ERR(0, 381, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kwargs);
          if (value) { values[3] = value; kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_predict_get_value") < 0)) __PYX_ERR(0, 381, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_goals_2D = values[0];
    __pyx_v_scores = values[1];
    __pyx_v_selected_points = values[2];
    __pyx_v_kwargs = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_predict_get_value", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 381, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython.set_predict_get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12utils_cython_22set_predict_get_value(__pyx_self, __pyx_v_goals_2D, __pyx_v_scores, __pyx_v_selected_points, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_22set_predict_get_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_goals_2D, PyObject *__pyx_v_scores, PyObject *__pyx_v_selected_points, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_predict_get_value", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("utils_cython.set_predict_get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__40 = PyTuple_Pack(4, __pyx_n_s_goals_2D, __pyx_n_s_scores, __pyx_n_s_selected_points, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);
  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_set_predict_get_value, 381, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 381, __pyx_L1_error)
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_23set_predict_get_value, 0, __pyx_n_s_set_predict_get_value, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__42);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_predict_get_value, __pyx_t_2) < 0) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_tuple__42 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);
+382:     return _set_predict_get_value(goals_2D, scores, selected_points, kwargs)
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(((__pyx_v_goals_2D) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_goals_2D, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 382, __pyx_L1_error)
  if (!(likely(((__pyx_v_scores) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_scores, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 382, __pyx_L1_error)
  if (!(likely(((__pyx_v_selected_points) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_selected_points, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 382, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_12utils_cython__set_predict_get_value(((PyArrayObject *)__pyx_v_goals_2D), ((PyArrayObject *)__pyx_v_scores), ((PyArrayObject *)__pyx_v_selected_points), __pyx_v_kwargs); if (unlikely(__pyx_t_1 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 382, __pyx_L1_error)
  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;
 383: 
+384: def _set_predict_next_step(np.ndarray[np.float32_t, ndim=2] goals_2D,
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_25_set_predict_next_step(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_25_set_predict_next_step = {"_set_predict_next_step", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_25_set_predict_next_step, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_25_set_predict_next_step(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyArrayObject *__pyx_v_goals_2D = 0;
  PyArrayObject *__pyx_v_scores = 0;
  PyArrayObject *__pyx_v_selected_points = 0;
  float __pyx_v_lr;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_predict_next_step (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_goals_2D,&__pyx_n_s_scores,&__pyx_n_s_selected_points,&__pyx_n_s_lr,&__pyx_n_s_kwargs,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_goals_2D)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_scores)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_set_predict_next_step", 1, 5, 5, 1); __PYX_ERR(0, 384, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_selected_points)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_set_predict_next_step", 1, 5, 5, 2); __PYX_ERR(0, 384, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lr)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_set_predict_next_step", 1, 5, 5, 3); __PYX_ERR(0, 384, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kwargs)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("_set_predict_next_step", 1, 5, 5, 4); __PYX_ERR(0, 384, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_set_predict_next_step") < 0)) __PYX_ERR(0, 384, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
    }
    __pyx_v_goals_2D = ((PyArrayObject *)values[0]);
    __pyx_v_scores = ((PyArrayObject *)values[1]);
    __pyx_v_selected_points = ((PyArrayObject *)values[2]);
    __pyx_v_lr = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_lr == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 387, __pyx_L3_error)
    __pyx_v_kwargs = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_predict_next_step", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 384, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython._set_predict_next_step", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_goals_2D), __pyx_ptype_5numpy_ndarray, 1, "goals_2D", 0))) __PYX_ERR(0, 384, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scores), __pyx_ptype_5numpy_ndarray, 1, "scores", 0))) __PYX_ERR(0, 385, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_selected_points), __pyx_ptype_5numpy_ndarray, 1, "selected_points", 0))) __PYX_ERR(0, 386, __pyx_L1_error)
  __pyx_r = __pyx_pf_12utils_cython_24_set_predict_next_step(__pyx_self, __pyx_v_goals_2D, __pyx_v_scores, __pyx_v_selected_points, __pyx_v_lr, __pyx_v_kwargs);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_24_set_predict_next_step(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_goals_2D, PyArrayObject *__pyx_v_scores, PyArrayObject *__pyx_v_selected_points, float __pyx_v_lr, PyObject *__pyx_v_kwargs) {
  CYTHON_UNUSED int __pyx_v_step;
  int __pyx_v_j;
  int __pyx_v_ok;
  int __pyx_v_num_step;
  float __pyx_v_nxt_expectation;
  float __pyx_v_best_expectation;
  PyArrayObject *__pyx_v_nxt_points = 0;
  PyArrayObject *__pyx_v_best_points = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_best_points;
  __Pyx_Buffer __pyx_pybuffer_best_points;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_goals_2D;
  __Pyx_Buffer __pyx_pybuffer_goals_2D;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nxt_points;
  __Pyx_Buffer __pyx_pybuffer_nxt_points;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_scores;
  __Pyx_Buffer __pyx_pybuffer_scores;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_selected_points;
  __Pyx_Buffer __pyx_pybuffer_selected_points;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_predict_next_step", 0);
  __pyx_pybuffer_nxt_points.pybuffer.buf = NULL;
  __pyx_pybuffer_nxt_points.refcount = 0;
  __pyx_pybuffernd_nxt_points.data = NULL;
  __pyx_pybuffernd_nxt_points.rcbuffer = &__pyx_pybuffer_nxt_points;
  __pyx_pybuffer_best_points.pybuffer.buf = NULL;
  __pyx_pybuffer_best_points.refcount = 0;
  __pyx_pybuffernd_best_points.data = NULL;
  __pyx_pybuffernd_best_points.rcbuffer = &__pyx_pybuffer_best_points;
  __pyx_pybuffer_goals_2D.pybuffer.buf = NULL;
  __pyx_pybuffer_goals_2D.refcount = 0;
  __pyx_pybuffernd_goals_2D.data = NULL;
  __pyx_pybuffernd_goals_2D.rcbuffer = &__pyx_pybuffer_goals_2D;
  __pyx_pybuffer_scores.pybuffer.buf = NULL;
  __pyx_pybuffer_scores.refcount = 0;
  __pyx_pybuffernd_scores.data = NULL;
  __pyx_pybuffernd_scores.rcbuffer = &__pyx_pybuffer_scores;
  __pyx_pybuffer_selected_points.pybuffer.buf = NULL;
  __pyx_pybuffer_selected_points.refcount = 0;
  __pyx_pybuffernd_selected_points.data = NULL;
  __pyx_pybuffernd_selected_points.rcbuffer = &__pyx_pybuffer_selected_points;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer, (PyObject*)__pyx_v_goals_2D, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 384, __pyx_L1_error)
  }
  __pyx_pybuffernd_goals_2D.diminfo[0].strides = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_goals_2D.diminfo[0].shape = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_goals_2D.diminfo[1].strides = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_goals_2D.diminfo[1].shape = __pyx_pybuffernd_goals_2D.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scores.rcbuffer->pybuffer, (PyObject*)__pyx_v_scores, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 384, __pyx_L1_error)
  }
  __pyx_pybuffernd_scores.diminfo[0].strides = __pyx_pybuffernd_scores.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scores.diminfo[0].shape = __pyx_pybuffernd_scores.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_selected_points.rcbuffer->pybuffer, (PyObject*)__pyx_v_selected_points, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 384, __pyx_L1_error)
  }
  __pyx_pybuffernd_selected_points.diminfo[0].strides = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_selected_points.diminfo[0].shape = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_selected_points.diminfo[1].strides = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_selected_points.diminfo[1].shape = __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.shape[1];
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_best_points.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nxt_points.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selected_points.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("utils_cython._set_predict_next_step", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_best_points.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_goals_2D.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nxt_points.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scores.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_selected_points.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_nxt_points);
  __Pyx_XDECREF((PyObject *)__pyx_v_best_points);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__43 = PyTuple_Pack(13, __pyx_n_s_goals_2D, __pyx_n_s_scores, __pyx_n_s_selected_points, __pyx_n_s_lr, __pyx_n_s_kwargs, __pyx_n_s_step, __pyx_n_s_j, __pyx_n_s_ok, __pyx_n_s_num_step, __pyx_n_s_nxt_expectation, __pyx_n_s_best_expectation, __pyx_n_s_nxt_points, __pyx_n_s_best_points); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_25_set_predict_next_step, 0, __pyx_n_s_set_predict_next_step, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_predict_next_step, __pyx_t_2) < 0) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_set_predict_next_step, 384, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 384, __pyx_L1_error)
 385:                            np.ndarray[np.float32_t, ndim=1] scores,
 386:                            np.ndarray[np.float32_t, ndim=2] selected_points,
 387:                            float lr, kwargs):
 388:     cdef:
+389:         int step, j, ok, num_step = 100
  __pyx_v_num_step = 0x64;
+390:         float nxt_expectation, best_expectation = _set_predict_get_value(goals_2D, scores, selected_points, kwargs)
  __pyx_t_1 = __pyx_f_12utils_cython__set_predict_get_value(((PyArrayObject *)__pyx_v_goals_2D), ((PyArrayObject *)__pyx_v_scores), ((PyArrayObject *)__pyx_v_selected_points), __pyx_v_kwargs); if (unlikely(__pyx_t_1 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 390, __pyx_L1_error)
  __pyx_v_best_expectation = __pyx_t_1;
+391:         np.ndarray[np.float32_t, ndim = 2] nxt_points = np.zeros((6, 2), dtype=np.float32)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 391, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__11, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 391, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nxt_points.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_nxt_points = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 391, __pyx_L1_error)
    } else {__pyx_pybuffernd_nxt_points.diminfo[0].strides = __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nxt_points.diminfo[0].shape = __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nxt_points.diminfo[1].strides = __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nxt_points.diminfo[1].shape = __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_nxt_points = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
+392:         np.ndarray[np.float32_t, ndim = 2] best_points = selected_points.copy()
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_selected_points), __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[1] = {__pyx_t_3, };
    __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 392, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_best_points.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_best_points = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_best_points.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 392, __pyx_L1_error)
    } else {__pyx_pybuffernd_best_points.diminfo[0].strides = __pyx_pybuffernd_best_points.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_best_points.diminfo[0].shape = __pyx_pybuffernd_best_points.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_best_points.diminfo[1].strides = __pyx_pybuffernd_best_points.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_best_points.diminfo[1].shape = __pyx_pybuffernd_best_points.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_best_points = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
 393: 
+394:     if kwargs is not None and 'dynamic_label-double' in kwargs:
  __pyx_t_10 = (__pyx_v_kwargs != Py_None);
  if (__pyx_t_10) {
  } else {
    __pyx_t_9 = __pyx_t_10;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_dynamic_label_double, __pyx_v_kwargs, Py_EQ)); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 394, __pyx_L1_error)
  __pyx_t_9 = __pyx_t_10;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_9) {
/* … */
  }
+395:         num_step = 200
    __pyx_v_num_step = 0xC8;
 396: 
+397:     for step in range(num_step):
  __pyx_t_7 = __pyx_v_num_step;
  __pyx_t_11 = __pyx_t_7;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_step = __pyx_t_12;
+398:         for j in range(6):
    for (__pyx_t_13 = 0; __pyx_t_13 < 6; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;
+399:             nxt_points[j, 0] = selected_points[j, 0]
      __pyx_t_14 = __pyx_v_j;
      __pyx_t_15 = 0;
      __pyx_t_16 = __pyx_v_j;
      __pyx_t_17 = 0;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_nxt_points.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_selected_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_selected_points.diminfo[1].strides));
+400:             nxt_points[j, 1] = selected_points[j, 1]
      __pyx_t_15 = __pyx_v_j;
      __pyx_t_14 = 1;
      __pyx_t_17 = __pyx_v_j;
      __pyx_t_16 = 1;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_nxt_points.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_selected_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_selected_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_selected_points.diminfo[1].strides));
    }
 401: 
 402:         if True:
+403:             while True:
    while (1) {
+404:                 ok = 0
      __pyx_v_ok = 0;
+405:                 for j in range(6):
      for (__pyx_t_13 = 0; __pyx_t_13 < 6; __pyx_t_13+=1) {
        __pyx_v_j = __pyx_t_13;
+406:                     if get_rand(0.0, 1.0) < 0.5:
        __pyx_t_18 = __pyx_f_12utils_cython_get_rand(0.0, 1.0); if (unlikely(__pyx_t_18 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L1_error)
        __pyx_t_9 = (__pyx_t_18 < 0.5);
        if (__pyx_t_9) {
/* … */
        }
      }
+407:                         nxt_points[j, 0] += get_rand(-lr, lr)
          __pyx_t_18 = __pyx_f_12utils_cython_get_rand((-__pyx_v_lr), __pyx_v_lr); if (unlikely(__pyx_t_18 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 407, __pyx_L1_error)
          __pyx_t_14 = __pyx_v_j;
          __pyx_t_15 = 0;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_nxt_points.diminfo[1].strides) += __pyx_t_18;
+408:                         nxt_points[j, 1] += get_rand(-lr, lr)
          __pyx_t_18 = __pyx_f_12utils_cython_get_rand((-__pyx_v_lr), __pyx_v_lr); if (unlikely(__pyx_t_18 == ((__pyx_t_5numpy_float32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 408, __pyx_L1_error)
          __pyx_t_15 = __pyx_v_j;
          __pyx_t_14 = 1;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_nxt_points.diminfo[1].strides) += __pyx_t_18;
+409:                         ok = 1
          __pyx_v_ok = 1;
+410:                 if ok:
      __pyx_t_9 = (__pyx_v_ok != 0);
      if (__pyx_t_9) {
/* … */
      }
    }
    __pyx_L11_break:;
+411:                     break
        goto __pyx_L11_break;
 412: 
+413:         nxt_expectation = _set_predict_get_value(goals_2D, scores, nxt_points, kwargs)
    __pyx_t_1 = __pyx_f_12utils_cython__set_predict_get_value(((PyArrayObject *)__pyx_v_goals_2D), ((PyArrayObject *)__pyx_v_scores), ((PyArrayObject *)__pyx_v_nxt_points), __pyx_v_kwargs); if (unlikely(__pyx_t_1 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 413, __pyx_L1_error)
    __pyx_v_nxt_expectation = __pyx_t_1;
+414:         if nxt_expectation < best_expectation:
    __pyx_t_9 = (__pyx_v_nxt_expectation < __pyx_v_best_expectation);
    if (__pyx_t_9) {
/* … */
    }
  }
+415:             best_expectation = nxt_expectation
      __pyx_v_best_expectation = __pyx_v_nxt_expectation;
+416:             for j in range(6):
      for (__pyx_t_13 = 0; __pyx_t_13 < 6; __pyx_t_13+=1) {
        __pyx_v_j = __pyx_t_13;
+417:                 best_points[j, 0], best_points[j, 1] = nxt_points[j, 0], nxt_points[j, 1]
        __pyx_t_14 = __pyx_v_j;
        __pyx_t_15 = 0;
        __pyx_t_18 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_nxt_points.diminfo[1].strides));
        __pyx_t_15 = __pyx_v_j;
        __pyx_t_14 = 1;
        __pyx_t_19 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_nxt_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_nxt_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_nxt_points.diminfo[1].strides));
        __pyx_t_14 = __pyx_v_j;
        __pyx_t_15 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_best_points.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_best_points.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_best_points.diminfo[1].strides) = __pyx_t_18;
        __pyx_t_15 = __pyx_v_j;
        __pyx_t_14 = 1;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float32_t *, __pyx_pybuffernd_best_points.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_best_points.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_best_points.diminfo[1].strides) = __pyx_t_19;
      }
 418: 
+419:     return nxt_expectation, best_points
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_nxt_expectation); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  __Pyx_INCREF((PyObject *)__pyx_v_best_points);
  __Pyx_GIVEREF((PyObject *)__pyx_v_best_points);
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_best_points));
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;
 420: 
+421: def set_predict_next_step(goals_2D, scores, selected_points, lr=1.0, kwargs=None):
/* Python wrapper */
static PyObject *__pyx_pw_12utils_cython_27set_predict_next_step(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_12utils_cython_27set_predict_next_step = {"set_predict_next_step", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_12utils_cython_27set_predict_next_step, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_12utils_cython_27set_predict_next_step(PyObject *__pyx_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_goals_2D = 0;
  PyObject *__pyx_v_scores = 0;
  PyObject *__pyx_v_selected_points = 0;
  PyObject *__pyx_v_lr = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_predict_next_step (wrapper)", 0);
  {
    PyObject **__pyx_pyargnames[] = {&__pyx_n_s_goals_2D,&__pyx_n_s_scores,&__pyx_n_s_selected_points,&__pyx_n_s_lr,&__pyx_n_s_kwargs,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)((PyObject*)__pyx_float_1_0));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_goals_2D)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 421, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_scores)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 421, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("set_predict_next_step", 0, 3, 5, 1); __PYX_ERR(0, 421, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_selected_points)) != 0)) kw_args--;
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 421, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("set_predict_next_step", 0, 3, 5, 2); __PYX_ERR(0, 421, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lr);
          if (value) { values[3] = value; kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 421, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kwargs);
          if (value) { values[4] = value; kw_args--; }
          else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 421, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_predict_next_step") < 0)) __PYX_ERR(0, 421, __pyx_L3_error)
      }
    } else {
      switch (__pyx_nargs) {
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_goals_2D = values[0];
    __pyx_v_scores = values[1];
    __pyx_v_selected_points = values[2];
    __pyx_v_lr = values[3];
    __pyx_v_kwargs = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_predict_next_step", 0, 3, 5, __pyx_nargs); __PYX_ERR(0, 421, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("utils_cython.set_predict_next_step", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_12utils_cython_26set_predict_next_step(__pyx_self, __pyx_v_goals_2D, __pyx_v_scores, __pyx_v_selected_points, __pyx_v_lr, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_12utils_cython_26set_predict_next_step(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_goals_2D, PyObject *__pyx_v_scores, PyObject *__pyx_v_selected_points, PyObject *__pyx_v_lr, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_predict_next_step", 0);
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("utils_cython.set_predict_next_step", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* … */
  __pyx_tuple__45 = PyTuple_Pack(5, __pyx_n_s_goals_2D, __pyx_n_s_scores, __pyx_n_s_selected_points, __pyx_n_s_lr, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);
  __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_cython_pyx, __pyx_n_s_set_predict_next_step_2, 421, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 421, __pyx_L1_error)
/* … */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_12utils_cython_27set_predict_next_step, 0, __pyx_n_s_set_predict_next_step_2, NULL, __pyx_n_s_utils_cython, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__47);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_predict_next_step_2, __pyx_t_2) < 0) __PYX_ERR(0, 421, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+422:     return _set_predict_next_step(goals_2D, scores, selected_points, lr, kwargs)
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_set_predict_next_step); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_3, __pyx_v_goals_2D, __pyx_v_scores, __pyx_v_selected_points, __pyx_v_lr, __pyx_v_kwargs};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 5+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;