You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support variably sized observations with suitable embedding net #1324
Is your feature request related to a problem? Please describe.
Handling variable-size observations, such as those used with permutation-invariant embedding networks, RNNs, or Transformers, currently requires padding inputs (e.g., with NaNs) to a fixed size. While this approach is nice for batching during training, at test time, it's preferable to also support working with tensors of varying lengths directly.
Unfortunately, the current input_shape checks prevent this, even when the underlying methods could handle variable-length inputs without issue.
As a workaround, it's necessary to manually override the inferred shapes to bypass these checks:
Right now, we enforce the condition (e.g., x_o), to be of the correct event_shape, by calling x = reshape_to_batch_event(x,...) either in the Posterior or the potential (which is very messy). However, in the case where the condition can have a variable size, and we have an embedding network that can handle this, the reshaping fails.
Suggested steps:
Change functionality of reshape_to_batch_event to allow for variable sized conditions
Check whether x_o is a valid shape by checking if the embedded input (e.g., add _embedded_condition_shape property to Estimator objects
Remove redundant shape checks: ideally, shape checks should be happening at the same place regardless of the method.
Activity
janfb commentedon Dec 13, 2024
related to #218
gmoss13 commentedon Feb 26, 2025
More context for resolving this:
Right now, we enforce the
condition(e.g.,x_o), to be of the correctevent_shape, by callingx = reshape_to_batch_event(x,...)either in thePosterioror thepotential(which is very messy). However, in the case where the condition can have a variable size, and we have an embedding network that can handle this, the reshaping fails.Suggested steps:
reshape_to_batch_eventto allow for variable sized conditionsx_ois a valid shape by checking if the embedded input (e.g., add_embedded_condition_shapeproperty toEstimator objects[-]Variably sizes observations[/-][+]Support variably sized observations with suitable embedding net[/+]