Skip to content

Commit

Permalink
Ensure 3D sampling works
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanradev93 committed Jul 10, 2024
1 parent 5682167 commit f859c00
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bayesflow/networks/flow_matching/flow_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
)

from bayesflow.types import Tensor
from bayesflow.utils import expand_right_as, find_network, jacobian_trace, keras_kwargs, optimal_transport
from bayesflow.utils import expand_right_as, find_network, jacobian_trace, keras_kwargs, optimal_transport, tile_axis

from ..inference_network import InferenceNetwork

Expand Down Expand Up @@ -50,6 +50,8 @@ def velocity(self, x: Tensor, t: int | float | Tensor, conditions: Tensor = None
t = keras.ops.full((keras.ops.shape(x)[0],), t, dtype=keras.ops.dtype(x))

t = expand_right_as(t, x)
if keras.ops.ndim(x) == 3:
t = tile_axis(t, axis=1, n=keras.ops.shape(x)[1])

if conditions is None:
xtc = keras.ops.concatenate([x, t], axis=-1)
Expand Down

0 comments on commit f859c00

Please sign in to comment.