code: def xlog1py(
      a: Union[TensorLikeType, NumberType],
      b: Union[TensorLikeType, NumberType],
  ):
      torch._check(
          isinstance(a, TensorLike) or isinstance(b, TensorLike),
          lambda: 'Expected either argument a or b to be a Tensor"',
      )
  
      # Operations like eq and log do not handle scalar values, so we convert them to scalar_tensors.
      if isinstance(a, TensorLike) and isinstance(b, Number):
          b = refs.scalar_tensor(b, dtype=a.dtype, device=a.device)
      elif isinstance(b, TensorLike) and isinstance(a, Number):
          a = refs.scalar_tensor(a, dtype=b.dtype, device=b.device)
  
      # mypy: expected "Tensor"
      assert isinstance(a, TensorLike)
      assert isinstance(b, TensorLike)
      rhs = torch.where(torch.eq(a, 0), 0, torch.mul(a, torch.log1p(b)))
      return torch.where(torch.isnan(b), float("nan"), rhs)
  
imports: import math
  from typing import Optional, Union
  import torch
  import torch._prims
  import torch._prims_common
  import torch._refs
  from torch import Tensor
  from torch._decomp import register_decomposition
  from torch._prims_common import ELEMENTWISE_TYPE_PROMOTION_KIND, Number, NumberType, TensorLike, TensorLikeType
  from torch._prims_common.wrappers import elementwise_type_promotion_wrapper, out_wrapper
  from torch._refs import _make_alias, _make_elementwise_binary_reference, _make_elementwise_unary_reference
label_desc: Use image node_id 10 for calling a global function with example usage: xlog1py(a, b) and returns: torch