aesara-devs / aehmc

An HMC/NUTS implementation in Aesara

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning when running the `HMC.ipynb` notebook

rlouf opened this issue · comments

Although the code runs and the results seem unaffected, cell 12 returns the following warning:

WARNING (aesara.tensor.basic_opt): Failed to infer_shape from Op normal_rv{0, (0, 0), floatX, False}.
Input shapes: [None, (TensorConstant{1},), (), (), ()]
Exception encountered during infer_shape: <class 'ValueError'>
Exception message: Length of <TensorType(int64, vector)> cannot be determined

This was discovered in #29 but also happens on main with aeppl v0.0.12. This warning did not appear with previous versions in aeppl so I believe this is linked to a recent change in the library. Here is the corresponding subgraph:

> |   |InplaceDimShuffle{} [id DJ] ''   
 > |   | |Gemv{no_inplace} [id DK] ''   
 > |   |   |AllocEmpty{dtype='float64'} [id DL] ''   
 > |   |   | |TensorConstant{1} [id DM]
 > |   |   |TensorConstant{1.0} [id DN]
 > |   |   |InplaceDimShuffle{x,0} [id DO] ''   
 > |   |   | |Elemwise{Mul}[(0, 1)] [id DP] ''   
 > |   |   |   |<TensorType(float64, vector)> [id DQ] -> [id DA]
 > |   |   |   |normal_rv{0, (0, 0), floatX, False}.1 [id DR] ''   
 > |   |   |     |<RandomGeneratorType> [id DS] -> [id CU]
 > |   |   |     |<TensorType(int64, vector)> [id DT] -> [id CY]
 > |   |   |     |TensorConstant{11} [id DU]
 > |   |   |     |TensorConstant{0} [id DV]
 > |   |   |     |TensorConstant{1} [id DM]
 > |   |   |Elemwise{mul,no_inplace} [id DW] ''   
 > |   |   | |inverse_mass_matrix_copy [id DX] -> [id CV]
 > |   |   | |<TensorType(float64, vector)> [id DQ] -> [id DA]
 > |   |   | |normal_rv{0, (0, 0), floatX, False}.1 [id DR] ''   
 > |   |   |TensorConstant{0.0} [id DY]

Interestingly the previous cells that apply the kernel for one step outside of the scan loop do not return this warning. I am working on a minimal example and will move the issue to aeppl if necessary.