Error in weighted inference model

Thank you very much. I have corrected the codes.

I fail to understand why the expected dimension is zero. In the reply by @junpenglao in this topic the Potential function does not include a shape value. (Actually, it seems to me that if you combine the input question with the provided answer none of the functions include a shape attribute)

The dimension 40 comes from the number of data points (and their weights)