def get_samples_from_trace(trace, with_intermediates=False):
    ' Extracts all sample values from a numpyro trace.\n\n    :param trace: trace object obtained from `numpyro.handlers.trace().get_trace()`\n    :param with_intermediates: If True, intermediate(/latent) samples from\n        sample site distributions are included in the result.\n    :return: Dictionary of sampled values associated with the names given\n        via `sample()` in the model. If with_intermediates is True,\n        dictionary values are tuples where the first element is the final\n        sample values and the second element is a list of intermediate values.\n    '
    samples = {k: ((v['value'], v['intermediates']) if with_intermediates else v['value']) for (k, v) in trace.items() if (v['type'] == 'sample')}
    return samples
Extracts all sample values from a numpyro trace.

:param trace: trace object obtained from `numpyro.handlers.trace().get_trace()`
:param with_intermediates: If True, intermediate(/latent) samples from
    sample site distributions are included in the result.
:return: Dictionary of sampled values associated with the names given
    via `sample()` in the model. If with_intermediates is True,
    dictionary values are tuples where the first element is the final
    sample values and the second element is a list of intermediate values.
def get_samples_from_trace(trace, with_intermediates=False):
    ' Extracts all sample values from a numpyro trace.\n\n    :param trace: trace object obtained from `numpyro.handlers.trace().get_trace()`\n    :param with_intermediates: If True, intermediate(/latent) samples from\n        sample site distributions are included in the result.\n    :return: Dictionary of sampled values associated with the names given\n        via `sample()` in the model. If with_intermediates is True,\n        dictionary values are tuples where the first element is the final\n        sample values and the second element is a list of intermediate values.\n    '
    samples = {k: ((v['value'], v['intermediates']) if with_intermediates else v['value']) for (k, v) in trace.items() if (v['type'] == 'sample')}
    return samples