code: def test_generate_data_plate(backend):
      num_points = 1000
      expected_mean = 2.0
  
      def model(data=None):
          loc = pyro.param("loc", torch.tensor(expected_mean))
          scale = pyro.param("scale", torch.tensor(1.0))
          with pyro.plate("data", 1000, dim=-1):
              x = pyro.sample("x", dist.Normal(loc, scale), obs=data)
          return x
  
      with pyro_backend(backend):
          data = model().data
          assert data.shape == (num_points,)
          mean = float(ops.sum(data)) / num_points
          assert mean == approx(expected_mean, abs=0.1)
  
imports: import warnings
  import pytest
  import torch
  from pytest import approx
  from torch.distributions import constraints
  from pyro.generic import distributions
  from pyro.generic import infer, ops, optim, pyro, pyro_backend
  from tests.common import assert_close, xfail_param
label_desc: Use image node_id 8 for calling a global function with example usage: test_generate_data_plate(backend) and returns: x