-
|
Hi all, I'm exploring how to integrate MNLE with pymc wrappers following this thread #987 I have 8 parameters in my model and [continuous value, discrete value] as the model output And I got these errors: I've tried to implement different versions in the colab code, but I got similar errors. Does anyone have any suggestions? Thank you in advance!! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @sheensu I am not totally sure, but it looks like the error might come from a shape mismatch between what PyMC passes into the MNLE potential and what MNLE expects. PyMC seems to send a 1-D I had a similar issue before, and adding a small reshape helped: def lp_f(x, track_gradients=True):
with torch.set_grad_enabled(track_gradients):
x = torch.tensor(x, dtype=torch.float32)
if x.ndim == 1:
x = x.unsqueeze(0)
return potential_fn(x) |
Beta Was this translation helpful? Give feedback.
Hi @sheensu
I am not totally sure, but it looks like the error might come from a shape mismatch between what PyMC passes into the MNLE potential and what MNLE expects. PyMC seems to send a 1-D
(8,)float64 array, while MNLE usuaaly expects a batched float32 tensor like(1, 8).I had a similar issue before, and adding a small reshape helped: