code: def unpack(value, symbol_to_dim):
      """
      Converts a packed tensor to an unpacked tensor.
  
      :param value: a number or tensor
      :param symbol_to_dim: a map from characters to negative integers
      """
      if isinstance(value, torch.Tensor):
          assert value.dim() == len(value._pyro_dims)
          if value.dim():
              unsorted_dims = [
                  symbol_to_dim[dim] for dim in value._pyro_dims
              ]
              dims = sorted(unsorted_dims)
              value = value.permute(
                  *(unsorted_dims.index(dim) for dim in dims)
              )
              shape = [1] * -min(dims)
              for dim, size in zip(dims, value.shape):
                  shape[dim] = size
              value = value.reshape(shape)
          else:
              value = value[...]  # ensure ._pyro_dims attr is not set
      return value
  
file_path: pyro/pyro/ops/packed.py
imports: import math
  import torch
  from pyro.distributions.util import is_identically_one
  from pyro.util import ignore_jit_warnings
label_desc: Use image node_id 2 for calling a global function with example usage: unpack(value, symbol_to_dim) and returns: value