code: def log_erfcx(x: Tensor) -> Tensor:
      """Computes the logarithm of the complementary scaled error function in a
      numerically stable manner. The GitHub issue tracks progress toward moving this
      feature into PyTorch in C++: https://github.com/pytorch/pytorch/issues/31945.
  
      Args:
          x: An input tensor with dtype torch.float32 or torch.float64.
  
      Returns:
          A tensor of values of the same type and shape as x containing log(erfcx(x)).
      """
      is_pos = x > 0
      x_pos = x.masked_fill(~is_pos, 0)
      x_neg = x.masked_fill(is_pos, 0)
      return torch.where(
          is_pos,
          torch.special.erfcx(x_pos).log(),
          torch.special.erfc(x_neg).log() + x.square(),
      )
  
imports: from __future__ import annotations
  import math
  from functools import lru_cache
  from math import pi
  from numbers import Number
  from typing import Any, Callable, Iterable, Iterator, Optional, Tuple, Union
  import torch
  from botorch.utils.safe_math import logdiffexp
  from numpy.polynomial.legendre import leggauss
  from torch import BoolTensor, LongTensor, Tensor
label_desc: Use image node_id 12 for calling a global function with example usage: log_erfcx(x) and returns: torch