code: def test_broadcast(event_shape, dist_shape, mask_shape):
      mask = torch.empty(torch.Size(mask_shape)).bernoulli_(0.5).bool()
      base_dist = Normal(torch.zeros(dist_shape + event_shape), 1.0)
      base_dist = base_dist.to_event(len(event_shape))
      assert base_dist.batch_shape == dist_shape
      assert base_dist.event_shape == event_shape
  
      d = base_dist.mask(mask)
      d_shape = broadcast_shape(mask.shape, base_dist.batch_shape)
      assert d.batch_shape == d_shape
      assert d.event_shape == event_shape
  
file_path: pyro/tests/distributions/test_mask.py
imports: import pytest
  import torch
  from torch import tensor
  from torch.distributions import kl_divergence
  from pyro.distributions.torch import Bernoulli, Normal
  from pyro.distributions.util import broadcast_shape, scale_and_mask
  from tests.common import assert_equal
label_desc: Use image node_id 4 for calling a global function with example usage: test_broadcast(event_shape, dist_shape, mask_shape) without return types