Consider the model
@model function inference_model(observed_data, params)
a, b, c = observed_data
...
end
Passing in a tuple for observed data
a = some_vector_a
b = some_vector_b
c = some_vector_c
observed_data = (a, b, c)
_m1 = inference_model(observed_data, params)
generates error
nested task error: ArgumentError: Some indices in the output vector were not set. This likely means that the vector values provided are not consistent with the LogDensityFunction (e.g. if they were obtained from a different model).
However, it works fine if you pass in the data individually
@model function inference_model(a, b, c, params)
...
end
a = some_vector_a
b = some_vector_b
c = some_vector_c
_m1 = inference_model(a, b, c, params)
From an old Slack thread (which might not be available to you past 90 days), penelope provides an explanation:
Oh, actually, never mind. I see why. The issue is that Turing looks at your argument names to see what is a random variable and what is data.
If you have x ~ dist, and x is an argument then it will be treated as data. Otherwise it will be a random variable (even if x is part of some larger aggregate that is an argument ).
It was then suggested in the Slack thread to make the docs a little bit more clear on this. I am just creating this issue so that it is tracked, and plan on submitting a PR as soon as possible.
Consider the model
Passing in a tuple for observed data
generates error
However, it works fine if you pass in the data individually
From an old Slack thread (which might not be available to you past 90 days), penelope provides an explanation:
It was then suggested in the Slack thread to make the docs a little bit more clear on this. I am just creating this issue so that it is tracked, and plan on submitting a PR as soon as possible.