Setting model inputs in compile_fn

I have a model with two inputs, material which is an n * 16 one hot encoded variable, and helix_angle, which is a 1 dimensional vector of length n. These are both represented by MutableData objects. It produces one observed variable VcFBR_obs.

After sampling, I am trying to compile this model to an aesara function with the following code.

VcModel = at.vector('VcFBR')
with VcFBR:
    material_in = aio.In(at.matrix('material'))
    helix_angle_in =aio.In(at.vector('helix_angle'))
    predictor = pymc.compile_fn(VcModel,inputs=[material_in,helix_angle_in],
                               givens=[(material,material_in),
                                       (helix_angle,helix_angle_in)])

However, this fails with the following error message

UnusedInputError: aesara.function was asked to create a function computing outputs given certain inputs, but the provided input variable at index 0 is not part of the computational graph needed to compute the outputs: material.
To make this error into a warning, you can pass the parameter on_unused_input='warn' to aesara.function. To disable it completely, use on_unused_input='ignore'.

How should I modify my code to make it work?

You didn’t specify the output of the function. What did you have in mind?

I want to be able to suppy material and helix_angle and get a predicted value for VcFBR_obs.

Then you need to specify VcFBR_obs as the output, but in your example that’s a simple input vector variable.

I don’t quite get what you are trying to achieve. SharedVariables cannot be used as explicit inputs and givens cannot be input variables either. Anyway, here is the minimal example of what I imagine you are trying to achieve, perhaps you can iterate from there?

import aesara.tensor as at
import pymc as pm

with pm.Model() as m:
  x = pm.Normal("x")
  y = pm.HalfNormal("y")
  z = pm.Normal("z", x, y, observed=5)

# x will be a numerical input in this case
fn = m.compile_fn(z, inputs=[x], random_seed=1)
fn({"x": 100})  # array(98.40837291)