Hey guys,
Found an issue with Dirichlet distribution. Sometimes, for no apparent reason, it outputs a tensor full of NaNs. The line causing the problem is as simple as:
doc_topics = Dirichlet(topic_weights).rsample()

topic_weights is asserted to be a valid tensor, always.
Now, I’m circumventing the problem by replacing the line above by the following code:
repeat = True
while repeat:
    doc_topics = Dirichlet(topic_weights).rsample()
    repeat = doc_topics.isnan().any()

It works… but it is as ugly as code can possibly be. (In Brazil we have a slang for that: “gambiarra” 1 )
Any hints on how to solve that?