code: def binary_cross_entropy_lerp(
      pred: torch.Tensor,
      gt: torch.Tensor,
      weight: torch.Tensor,
      lerp_bound: float,
  ):
      """
      Binary cross entropy which avoids exploding gradients by linearly
      extrapolating the log function for log(1-pred) mad log(pred) whenever
      pred or 1-pred is smaller than lerp_bound.
      """
      loss = (
          log_lerp(1 - pred, lerp_bound) * (1 - gt)
          + log_lerp(pred, lerp_bound) * gt
      )
      loss_reduced = -(loss * weight).sum() / weight.sum().clamp(1e-4)
      return loss_reduced
  
file_path: pytorch3d/pytorch3d/implicitron/tools/metric_utils.py
imports: import math
  from typing import Optional, Tuple
  import torch
  from torch.nn import functional
label_desc: Use image node_id 6 for calling a global function with example usage: binary_cross_entropy_lerp(pred, gt, weight, lerp_bound) and returns: loss_reduced