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

Allow broadcasting across dimensions in eval mode; always require X to be at least 2d #2518

Closed
wants to merge 1 commit into from

Commits on Sep 9, 2024

  1. Allow broadcasting across dimensions in eval mode; always require X t…

    …o be at least 2d
    
    Summary:
    Context:
    
    A discussion on allowable shapes for transforms concluded:
    * We should not allow for broadcasting across the -1 dimension, so the first check in _check_shape should always happen.
    * The shapes always need to be broadcastable, so the torch.broadcast_shapes check in _check_shape should always happen.
    * We want to allow for broadcasting across the batch dimension in eval model, so the check that X has dimension of at least len(batch_shape) + 2 should only happen in training mode.
    * For clarity, we should disallow 1d X, even if broadcastable. BoTorch tends to be strict about requiring explicit dimensions, e.g. GPyTorchModel._validate_tensor_args, and that's a good thing because confusion about tensor dimensions causes a lot of pain.
    
    This diff:
    * Only checks that X has number of dimensions equal to 2 + the number of batch dimensions in training mode.
    * Disallows <2d X.
    
    Differential Revision: D62404492
    esantorella authored and facebook-github-bot committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    1618797 View commit details
    Browse the repository at this point in the history