pymc-devs / pymc-devs/pytensor

JAX linker: Cannot compile Convolve1d without static mode

Open
#2,317 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
644
Forks
208
Avg merge
2d 14h
Merged PRs (30d)
16

Description

Problem

The JAX linker cannot compile Blockwise{Convolve1d} without static (known-at-compile-time) shapes.

NotImplementedError: Cannot compile Convolve1d to jax without static mode

MRE

import pytensor.tensor as pt
from pytensor.compile import Mode, function

x = pt.matrix("x")
kernel = pt.vector("k")
# Adstock-like convolution with dynamic shapes
result = pt.xlogx.xtensor.signal.conv1d(x, kernel, mode="full")
fn = function([x, kernel], result, mode=Mode(linker="jax", optimizer="fast_run"))

Context

This prevents the pymc-marketing MMM model from using the JAX linker for MCMC sampling. The adstock transformation uses Blockwise{Convolve1d} with dynamic shapes — the Numba and CVM linkers handle this correctly.

uv pip install jax jaxlib to reproduce.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Python MRE and trace the JAX linker path for Blockwise{Convolve1d}, focusing on why dynamic shapes are rejected while Numba and CVM support them. Reproduce the failure with the listed JAX installation, then verify that the MRE compiles and runs with dynamic shapes without regressing static-shape behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.