Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

374
Vistas
guvectorize Not resolving types in nopython mode

I'm struggling with a numba error Untyped global name 'is_a_subset': Cannot determine Numba type of <class 'numba.np.ufunc.gufunc.GUFunc'> This usually means I have fumbled and used a method that isn't supported by numba. The following code fails.

@guvectorize("(n),(n)->(n)",nopython=True)
def is_a_subset(x,y,out):
    out[:]=np.array([item in x for item in y])

@njit()
def test(x,y,z):
    is_a_subset(x,y,z)
    return z.mean()

x=np.array([[1,2,3],[3,2,1]])
y=np.array([[3,6,1],[1,2,3]])
z = np.empty_like(x)
test(x,y,z)

However removing njit on the test function makes everything work.

def test(x,y,z):
    is_a_subset(x,y,z)
    return z.mean()

Why is numba struggling to resolve types when in no-python mode?
I had also tried without different results

@guvectorize(["f8[:],f8[:],f8[:]"],"(n),(n)->(n)",nopython=True)
def is_a_subset(x,y,out):
    out[:]=np.array([item in x for item in y])
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I am using Numba 0.53.1 and can replicate this error. This blog on the dynamic dispatch update to guvectorize in Numba 0.53 mentions this at the end (emphasis added):

In the future we would like to bring the @guvectorize capabilities closer to the @vectorize ones. For instance, currently it is not possible to call a guvectorize function from a jitted (@jit) function.

There is a similar open issue with vectorize, but it demonstrates that @vectorize functions can be called in @jit functions, just that it's restricted to the default target = "cpu".

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda