Hello Everyone,

I am trying to get gradient of the loglikelihood function of a model. I am doing this to be able to compute Outer Product Gradient of my likelihood function. I used pm.gradient() on model.compile_logp() function but I got * AttributeError: ‘PointFunc’ object has no attribute ‘owner’* error.

I replicated my error below based on an example available on pymc quick start page. Please help me understand what may I be doing wrong?

I am using ‘4.0.1’ version of pymc.

**Code:**

import pymc as pm

import numpy as npRANDOM_SEED = 8927

rng = np.random.default_rng(RANDOM_SEED)

with pm.Model() as model:

mu = pm.Normal(“mu”, mu=0, sigma=1)

obs = pm.Normal(“obs”, mu=mu, sigma=1, observed=rng.standard_normal(100))model.compile_logp()({“mu”: 0})

#array(-143.03962875)#The code works uptil above line. Now I wanted to get gradient of the logp function.

#Hence, I wrote below codelogp = model.compile_logp()

log_grad = pm.gradient(logp)

#Below is the error I got

**Error:**

Thank you for your time.