code: def test_sample_shape_order():
      shape12 = torch.Size((1, 2))
      shape34 = torch.Size((3, 4))
      d = Bernoulli(0.5)
  
      # .expand_by(...) should add dimensions on the left.
      actual = d.expand_by(shape34).expand_by(shape12)
      expected = d.expand_by(shape12 + shape34)
      assert actual.event_shape == expected.event_shape
      assert actual.batch_shape == expected.batch_shape
  
file_path: pyro/tests/distributions/test_reshape.py
imports: import pytest
  import torch
  from pyro.distributions.torch import Bernoulli
  from tests.common import assert_equal
label_desc: Use image node_id 1 for calling a global function with example usage: test_sample_shape_order() without return types