BUG: matmul fails with zero-length broadcast batch dimensions
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 40/100
Línea de trabajo
Start in the recursive implementation of sparse.matmul and compare its batch handling with NumPy broadcasting for zero-sized dimensions. Reproduce the two examples in the issue, then add regression coverage for the listed rank, broadcasting, input type, dtype, and shape cases. Done when valid cases return NumPy-compatible shapes and invalid shapes still fail appropriately.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug
Batched sparse.matmul fails when a broadcast batch dimension is zero.
Reproduced on main at d63255057744331b96626a1f1c24504b3a3783cd.
import numpy as np
import sparse
a = sparse.COO.from_numpy(np.zeros((0, 2, 3)))
b = sparse.COO.from_numpy(np.zeros((0, 3, 4)))
sparse.matmul(a, b)
# ValueError: At least one array required.
a = sparse.COO.from_numpy(np.zeros((1, 2, 3)))
sparse.matmul(a, b)
# IndexError: Index is not smaller than dimension 0 >= 0
NumPy returns shape (0, 2, 4) in both cases. The recursive implementation either stacks an empty result list or iterates using max(1, 0), rather than the broadcast result size zero.
A focused empty-batch path and regression coverage are ready. The matrix exercises differing ranks, zero/singleton broadcasting, COO/GCXS/mixed dense inputs, dtype promotion and invalid contraction/batch shapes. Thirty-two new cases fail before the production change.
This is a different path from zero-length contracted axes in tensordot: the contracted dimension here is three and the failure happens in batch recursion.
This is an AI-assisted bug investigation with locally executed reproductions and tests. No assignment is requested.
- Lenguaje dominante
- Python
- Estrellas
- 670
- Forks
- 167
- Merge medio
- 3 d 4 h
- PR fusionados (30 d)
- 7
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pydata/sparse
-
Bug: full einsum contractions upcast the dtype and count booleansPosiblemente ocupada @RaphaelFakhri la tomó hace 17 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
BUG: ufunc outer rejects Python scalar and sequence operandsPosiblemente ocupada @nawaaaaaAaar la tomó hace 29 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 2 días
-
Bug: slices with a negative step and a negative stop return wrong elementsPosiblemente ocupada @JoeyTan21 la tomó hace 19 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 75/100
pydata/sparse#1019 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
BUG: zero-length tensor contractions ignore requested output typesPosiblemente ocupada @nawaaaaaAaar la tomó hace 29 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
-
BUG: inferred COO reshape dimensions lose integer precisionPosiblemente ocupada @nawaaaaaAaar la tomó hace 29 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
Los mantenedores suelen responder en 2 días
Todos los issues de pydata/sparse
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
abetlen/llama-cpp-python#2424 ·
Los mantenedores suelen responder en 1 día
-
Bug IronPython Python 3
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
pyrevitlabs/pyRevit#4184 ·
Los mantenedores suelen responder en 1 día
-
CLAW (Agents & Orchestration)Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
jqueryscript/awesome-claude-code#1009 ·
-
tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día