Skip to content

Commit 7f50d79

Browse files
committed
Fix type checking
1 parent da1b9fe commit 7f50d79

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ explicit = true
112112
[tool.ty.src]
113113
# The Warp-DSL kernel modules are excluded. Their kernel bodies are written in warp's kernel
114114
# language, which warp's type stubs cannot type.
115-
exclude = ["splax/_intersect.py", "splax/_project.py", "splax/_rasterize.py"]
115+
exclude = ["splax/_intersect.py", "splax/_project/_kernels.py", "splax/_rasterize/_kernels.py"]
116116

117117
[tool.pixi.workspace]
118118
channels = ["conda-forge"]

splax/_project/_project.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from typing import cast
1313

1414
import jax
15+
import jax.core
1516
import jax.numpy as jnp
1617

1718
from splax._project._kernels import (
@@ -169,7 +170,8 @@ def _materialize(ct: jax.Array | jax.custom_derivatives.SymbolicZero) -> jax.Arr
169170
# the cotangent's own shape and dtype, correct under batching too. XLA folds
170171
# the zeros away.
171172
if isinstance(ct, jax.custom_derivatives.SymbolicZero):
172-
return jnp.zeros(ct.aval.shape, ct.aval.dtype)
173+
aval = cast("jax.core.ShapedArray", ct.aval)
174+
return jnp.zeros(aval.shape, aval.dtype)
173175
return cast("jax.Array", ct)
174176

175177

0 commit comments

Comments
 (0)