pytensor icon indicating copy to clipboard operation
pytensor copied to clipboard

CGemv fails with strides0 x

Open ricardoV94 opened this issue 9 months ago • 0 comments

Description

import pytensor
import pytensor.tensor as pt
import numpy as np
from pytensor.compile.mode import get_mode
from pytensor.tensor.blas_c import CGemv

A = pt.tensor("A", shape=(None, None))
x = pt.tensor("x", shape=(None,))

out = CGemv(inplace=False)(
    pt.empty(A.shape[0]),
    pt.constant(np.array(1.0, dtype="float64")),
    A,
    x,
    pt.constant(np.array(0.0, dtype="float64"))
)
fn = pytensor.function([A, x], out)
A_test = np.array([[1.0]], dtype="float64")
x_test = np.array(1.0, dtype="float64")
x_test = np.broadcast_to(x_test, (1,))  # x_test.strides == (0,)
fn(A_test, x_test)  # Intel oneMKL ERROR: Parameter 8 was incorrect on entry to DGEMV .

This showed up in a PyMC test now that DimShuffle creates 0-strides inputs

ricardoV94 avatar Mar 04 '25 13:03 ricardoV94