Skip to content

dynamic and variable tensor shape handling in stan #748

Closed Answered by bob-carpenter
dskhanirfan asked this question in Q&A
Discussion options

You must be logged in to vote

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

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…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dskhanirfan
Comment options

Answer selected by mitzimorris
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants