The parameter probs has invalid values of Categorical distribution

  1. AutoDelta guide is used in my code.
  2. I am trying to use my own values to initialise the “auto” variational parameters, such as:
pyro.param('auto_token_emission', torch.tensor(init_token_emission).float(),

Note: the dimension of auto_token_emission is large, e.g… 9 * 13000

If I use my own initialisation, the error will be raised in my token_emission Categorical distribution of my model:

line 78, in model
  File "D:\Anaconda3\lib\site-packages\torch\distributions\", line 58, in __init__
    super(Categorical, self).__init__(batch_shape, validate_args=validate_args)
  File "D:\Anaconda3\lib\site-packages\torch\distributions\", line 36, in __init__
    raise ValueError("The parameter {} has invalid values".format(param))
ValueError: The parameter probs has invalid values

If I do not use my own initialisation, there was no error.

Alternatively, is there another way to initialise the auto_ parameters in the auto guide function?


it seems like the problem is exactly what the error message says. did you print out init_token_emission and see what elements are violating the constraint?