Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatch between doc strings and code in log_prob function #1316

Closed
rakaar opened this issue Dec 2, 2024 · 1 comment · Fixed by #1338
Closed

Mismatch between doc strings and code in log_prob function #1316

rakaar opened this issue Dec 2, 2024 · 1 comment · Fixed by #1338
Labels
question Further information is requested

Comments

@rakaar
Copy link

rakaar commented Dec 2, 2024

Here in doc strings of log_prob function method - https://github.com/sbi-dev/sbi/blob/main/sbi/neural_nets/estimators/nflows_flow.py#L84C46-L84C81

Args:
            input: Inputs to evaluate the log probability on. Of shape
                `(sample_dim, batch_dim, *event_shape)`.
            condition: Conditions of shape `(sample_dim, batch_dim, *event_shape)`.

Condition variable is expected to be of format (sample_dim, batch_dim, event_shape)
Dimension 0 - Sample
Dimension 1 - Batch
Dimension 2 - Event

But in function definition in this line - https://github.com/sbi-dev/sbi/blob/main/sbi/neural_nets/estimators/nflows_flow.py#L94

...
condition_batch_dim = condition.shape[0]
...

0th dimension is considered as batch dimension, while it should be 1st dimension as per the doc strings.

The mismatch might be lead to usage of incorrect tensor shapes.

@rakaar rakaar added the question Further information is requested label Dec 2, 2024
@janfb
Copy link
Contributor

janfb commented Dec 13, 2024

Hi @rakaar , thanks for reporting this. It's likely a typo in the docs, as we usually assume that the condition has shape (batch, *event_shape).
We will fix it in the upcoming release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants