code: def random_phylo_logits(num_leaves, dtype):
      # Construct a random phylogenetic problem.
      leaf_times = torch.randn(num_leaves, dtype=dtype)
      coal_times = dist.CoalescentTimes(leaf_times).sample()
      times = torch.cat([leaf_times, coal_times]).requires_grad_()
      assert times.dtype == dtype
  
      # Convert to a one-two-matching problem.
      ids = torch.arange(len(times))
      root = times.min(0).indices.item()
      sources = torch.cat([ids[:root], ids[root + 1 :]])
      destins = ids[num_leaves:]
      dt = times[sources][:, None] - times[destins]
      dt = dt * 10 / dt.detach().std()
      logits = torch.where(dt > 0, -dt, dt.new_tensor(-math.inf))
      assert logits.dtype == dtype
      logits.data += torch.empty_like(logits).uniform_()  # add jitter
  
      return logits, times
  
imports: import logging
  import math
  import pytest
  import torch
  import pyro.distributions
  from tests.common import assert_close, assert_equal, xfail_if_not_implemented
label_desc: Use image node_id 2 for calling a global function with example usage: random_phylo_logits(num_leaves, dtype) and returns: logits,  times