Making custom multivariate log density function with input of different dimensions work

I want to use the custom multivariate log density function logp_alpha via pymc.DensityDist in a pymc model.

How can I make pymc.DensityDist work with logp = logp_alpha, a 6-dimensional random variable alpha, the scalar-valued random variable a, an (numpy.ndarray) array A of size (6,6), and an array B of size (3,1) in the code below?

Running the code leads to the error message

TypeError: Cannot convert Type TensorType(float64, ()) (of Variable Alloc.0) into Type TensorType(float64, (6, 6)). You can try to manually convert Alloc.0 into a TensorType(float64, (6, 6)).

which seems to indicate that I have to pass the dimensions of alpha (and possibly A and B) to pymc.DensityDist. How can I do that?

import pytensor.tensor as pt
import pymc as pm

def logp_alpha(value, a, A, B):    
    log_det = pt.sum(pt.log(B) - pt.log(a))
    C = A / a    
    logp_alpha_out = 0.5 * log_det - 0.5 * value.T.dot(C).dot(value)    
    return logp_alpha_out

m = pm.Model()
with m:    
    a = pm.InverseGamma("a", 1, 0.001)    
    alpha = pm.DensityDist("alpha", a, A, B, logp = logp_alpha)

with m:
    data = pm.sample()   

Using the shape argument as follows
alpha = pm.DensityDist("alpha", a, A, B, logp = logp_alpha, shape = (6, 1))
solved the problem.