code: def sample_tree_approx(edge_logits, backend="python"):
      """
      Approximately sample a random spanning tree of a dense weighted graph.
  
      This is mainly useful for initializing an MCMC sampler.
  
      :param torch.Tensor edge_logits: A length-K array of nonnormalized log
          probabilities.
      :returns: An E x 2 tensor of edges in the form of (vertex,vertex) pairs.
          Each edge should be sorted and the entire tensor should be
          lexicographically sorted.
      :rtype: torch.Tensor
      """
      if backend == "python":
          return _sample_tree_approx(edge_logits)
      elif backend == "cpp":
          return _get_cpp_module().sample_tree_approx(edge_logits)
      else:
          raise ValueError("unknown backend: {}".format(repr(backend)))
  
imports: import itertools
  import math
  import torch
  from torch.distributions import constraints
  from torch.distributions.utils import lazy_property
  from pyro.distributions.torch_distribution import TorchDistribution
label_desc: Use image node_id 10 for calling a global function with example usage: sample_tree_approx(edge_logits, backend) and returns: _sample_tree_approx, _get_cpp_module