Combining models using switch

Not to hijack this thread, but I’m also running into a similar issue. I have an arrival/departure rate that can be positive or negative and I am attempting to model this as a Poisson process. The toy example below isn’t exactly what I am doing, but captures the spirit. This leads to an attribute error when I attempt to sample.

import numpy as np
import scipy
import pymc as pm
import aesara
import aesara.tensor as at

n = 200
dates = np.arange(n)
rates = scipy.stats.poisson(mu=3).rvs(n)
sign = scipy.stats.bernoulli(p=0.3).rvs(n)*2 - 1
obs = rates * sign


with pm.Model() as switch_model:
    switch_model.add_coord("date", dates, mutable=True)    
    
    rate_lambda = pm.Normal("rate_lambda", sigma=1)
    obs_sigma = pm.HalfNormal("obs_sigma", sigma=1)
    
    arrival_intensity = pm.Poisson("arrival_intensity", pm.math.abs(rate_lambda), dims="date")
    
    arrivals = pm.Deterministic(
        "arrivals",
         at.switch(
             rate_lambda >= 0,
             arrival_intensity,
             -arrival_intensity,
         ),
        dims="date"
    )
    arrivals_obs = pm.Normal("arrivals_obs", mu=arrivals, sigma=obs_sigma, dims="date", observed=obs)

with switch_model:
    pm.sample()

Which is giving the following error

python3.8/site-packages/aesara/tensor/elemwise.py in transform(r)
    619         def transform(r):
    620             # From a graph of ScalarOps, make a graph of Broadcast ops.
--> 621             if isinstance(r.type, (NullType, DisconnectedType)):
    622                 return r
    623             if r in scalar_inputs:

AttributeError: 'float' object has no attribute 'type'

I’m using the following versions and have some restrictions on being able to bump my versions. I’m wondering if it is possible to do something similar to what is outlined above using CustomDensity with my version restrictions?

pymc version: 4.2.1
aesara version: 2.8.6