dynamic and variable tensor shape handling in stan #748
-
0 I have a list of class 'numpy.ndarray', with each tensor of the following possible shapes (all entries will have same shape - each entry can be one of the following possible shapes)
how can I pass it to a dynamic input in stan which can handle this variable type of input dimensions |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
if all entries have the same shape, then you can specify the number of dimensions and their sizes as data. in the future, please ask your question on the Stan Forums: https://discourse.mc-stan.org |
Beta Was this translation helpful? Give feedback.
-
I'm not sure what you mean by all entries having the same shape, since you have listed a bunch of different shapes. In Stan, you need to specify the shape (e.g., matrix vs. vector vs. row vector) and the size of all variables other than function arguments. There's no way to write the equivalent of polymorphic Python code for NumPy's P.S. As @mitzimorris said, we prefer to have these kinds of questions on the forums rather than as issues, as they're not issues to fix in Stan itself. Having said that, we're happy to engage wherever users show up. |
Beta Was this translation helpful? Give feedback.
I'm not sure what you mean by all entries having the same shape, since you have listed a bunch of different shapes.
In Stan, you need to specify the shape (e.g., matrix vs. vector vs. row vector) and the size of all variables other than function arguments. There's no way to write the equivalent of polymorphic Python code for NumPy's
ndarray
within Stan. For any one of the shapes listed, you can write the corresponding Stan program, but there's no way to do it generically for arguments of differe…