code: def test_unweighted_samples(
      batch_shape, event_shape, sample_shape, dtype
  ):
      agg_dim_size = 5
      # empirical samples with desired shape
      dim_ordering = list(
          range(len(batch_shape + event_shape) + 1)
      )  # +1 for agg dim
      dim_ordering.insert(len(batch_shape), dim_ordering.pop())
      emp_samples = (
          torch.arange(agg_dim_size, dtype=dtype)
          .expand(batch_shape + event_shape + [agg_dim_size])
          .permute(dim_ordering)
      )
      # initial weight assignment
      weights = torch.ones(batch_shape + [agg_dim_size])
      empirical_dist = Empirical(emp_samples, weights)
      samples = empirical_dist.sample(
          sample_shape=torch.Size(sample_shape)
      )
      assert_equal(
          samples.size(),
          torch.Size(sample_shape + batch_shape + event_shape),
      )
  
file_path: pyro/tests/distributions/test_empirical.py
imports: import pytest
  import torch
  from pyro.distributions.empirical import Empirical
  from tests.common import assert_close, assert_equal
label_desc: Use image node_id 2 for calling a global function with example usage: test_unweighted_samples(batch_shape, event_shape, sample_shape, dtype) without return types