code: def _safe_shift(a, skew, t_scale, skew_abs):
      radius = 0.005
      hole = 1.0
      with torch.no_grad():
          near_hole = (a - hole).abs() <= radius
      if not near_hole.any():
          return _unsafe_shift(a, skew, t_scale)
  
      # Avoid the hole at a=1 by interpolating between points on either side.
      a_ = a.unsqueeze(-1).expand(a.shape + (2,)).contiguous()
      with torch.no_grad():
          lb, ub = a_.data.unbind(-1)
          lb[near_hole] = hole - radius
          ub[near_hole] = hole + radius
          # We don't need to backprop through weights, since we've pretended
          # a_ is reparametrized, even though we've clamped some values.
          weights = (
              (a_ - a.unsqueeze(-1))
              .abs_()
              .mul_(-1 / (2 * radius))
              .add_(1)
          )
          weights[~near_hole] = 0.5
      skew_ = skew.unsqueeze(-1)
      skew_abs_ = skew_abs.unsqueeze(-1)
      t_scale_ = skew_abs_.pow(a_.reciprocal())
      pairs = _unsafe_shift(a_, skew_, t_scale_)
      return (pairs * weights).sum(-1)
  
file_path: pyro/pyro/infer/reparam/stable.py
imports: import math
  import torch
  import pyro
  import pyro.distributions
  from pyro.distributions.stable import _standard_stable, _unsafe_standard_stable
  from pyro.infer.util import is_validation_enabled
  from .reparam import Reparam
label_desc: Use image node_id 2 for calling a global function with example usage: _safe_shift(a, skew, t_scale, skew_abs) and returns: unknown, _unsafe_shift