code: def softplus(
      a: TensorLikeType,
      beta: Optional[NumberType] = None,
      threshold: NumberType = 20,
      inplace: bool = False,
  ) -> TensorLikeType:
      """
      Reference implementation of torch.nn.functional.softplus
      """
  
      if inplace:
          raise NotImplementedError
  
      rhs: TensorLikeType
      if beta is not None:
          python_type = utils.dtype_to_type(a.dtype)
          if not utils.is_weakly_lesser_type(type(beta), python_type):
              msg = f"beta argument of type {type(beta)} cannot be safely cast to type {python_type}!"
              raise ValueError(msg)
          scaled_input = a * beta
          rhs = torch.true_divide(torch.log1p(torch.exp(scaled_input)), beta)  # type: ignore[arg-type]
  
      else:
          scaled_input = a
          rhs = torch.log1p(torch.exp(scaled_input))
  
      return torch.where(scaled_input > threshold, a, rhs)
  
imports: import math
  from functools import wraps
  from typing import Callable, Optional, Union
  import torch
  import torch._prims
  import torch._prims_common
  import torch._refs
  from torch._decomp import register_decomposition
  from torch._prims_common import ELEMENTWISE_TYPE_PROMOTION_KIND, NumberType, ShapeType, TensorLike, TensorLikeType
  from torch._prims_common.wrappers import elementwise_type_promotion_wrapper, elementwise_unary_scalar_wrapper, out_wrapper
  from torch._refs import _make_inplace
label_desc: Use image node_id 15 for calling a global function with example usage: softplus(a, beta, threshold, inplace) and returns: torch