code: def rdiag(v):
      """Converts the rightmost dimension to a diagonal matrix."""
      return rexpand(v, v.shape[-1]) * torch.eye(v.shape[-1])
  
file_path: pyro/pyro/contrib/util.py
imports: import weakref
  from collections import OrderedDict
  import torch
  import pyro
label_desc: Use image node_id 8 for calling a global function with example usage: rdiag(v) and returns: unknown