code: def test_prefix_condition(Dist, batch_shape, t, f, dim):
      if Dist is dist.LinearHMM:
          pytest.xfail(reason="not implemented")
      duration = t + f
      d = random_dist(Dist, batch_shape + (duration, dim))
      d = d.to_event(2 - d.event_dim)
      data = d.sample()
      expected = d.log_prob(data)
      d2 = prefix_condition(d, data[..., :t, :])
      actual = d2.log_prob(data[..., t:, :])
      actual.shape == expected.shape
  
file_path: pyro/tests/contrib/forecast/test_util.py
imports: import pytest
  import torch
  from torch.distributions import transform_to
  import pyro.distributions
  from pyro.contrib.forecast.util import UNIVARIATE_DISTS, UNIVARIATE_TRANSFORMS, prefix_condition, reshape_batch
  from tests.ops.gaussian import random_mvn
label_desc: Use image node_id 2 for calling a global function with example usage: test_prefix_condition(Dist, batch_shape, t, f, dim) without return types