code: def generate_data(args):
      """
      This implements the generative process of [1], but using larger feature and
      latent spaces ([1] assumes ``feature_dim=1`` and ``latent_dim=5``).
      """
      z = dist.Bernoulli(0.5).sample([args.num_data])
      x = (
          dist.Normal(z, 5 * z + 3 * (1 - z))
          .sample([args.feature_dim])
          .t()
      )
      t = dist.Bernoulli(0.75 * z + 0.25 * (1 - z)).sample()
      y = dist.Bernoulli(logits=3 * (z + 2 * (2 * t - 2))).sample()
  
      # Compute true ite for evaluation (via Monte Carlo approximation).
      t0_t1 = torch.tensor([[0.0], [1.0]])
      y_t0, y_t1 = dist.Bernoulli(
          logits=3 * (z + 2 * (2 * t0_t1 - 2))
      ).mean
      true_ite = y_t1 - y_t0
      return x, t, y, true_ite
  
file_path: pyro/examples/contrib/cevae/synthetic.py
imports: import argparse
  import logging
  import torch
  import pyro
  import pyro.distributions
  from pyro.contrib.cevae import CEVAE
label_desc: Use image node_id 1 for calling a global function with example usage: generate_data(args) and returns: x,  t,  y,  true_ite