gpytorch icon indicating copy to clipboard operation
gpytorch copied to clipboard

[Feature Request] Add batch_shape property to GP models

Open Balandat opened this issue 2 years ago • 2 comments

🚀 Feature Request

Expose a batch_shape property on models. For Exact GPs or models that have all the training inputs, this can just return the batch shape of the input tensors. For other models this can be overwritten as needed

Motivation

See https://github.com/pytorch/botorch/issues/1680#issuecomment-1466331781 - for some fantasizing functionality we'd like to know what the batch shape of the model is to appropriately fantasize based on model outputs.

There are a lot of other use cases for such property, we currently have this defined on the botorch Model class and are using it in a number of places (check the botorch repo).

Pitch

Describe the solution you'd like Upstream the functionality from botorch.

Describe alternatives you've considered Not doing this. The downside is that it makes things rather cumbersome and requires some workarounds.

Are you willing to open a pull request? (We LOVE contributions!!!) Sure

Balandat avatar Mar 13 '23 22:03 Balandat

@gpleiss any thoughts on this?

Balandat avatar Mar 13 '23 22:03 Balandat

Yeah this is a great idea!

gpleiss avatar Mar 16 '23 14:03 gpleiss