code: def elu(
      a: TensorLikeType,
      alpha: NumberType = 1.0,
      scale: NumberType = 1.0,
      input_scale: NumberType = 1.0,
      inplace: bool = False,
  ) -> TensorLikeType:
      """
      Reference implementation of torch.nn.functional.elu
      """
      if inplace:
          raise NotImplementedError
  
      # nb. This should be factored out into a can_cast aux function
      python_type = utils.dtype_to_type(a.dtype)
      torch._check(
          utils.is_weakly_lesser_type(type(input_scale), python_type),
          lambda: f"input_scale argument of type {type(input_scale)} cannot be safely cast to type {python_type}!",
      )
      torch._check(
          utils.is_weakly_lesser_type(type(scale), python_type),
          lambda: f"scale argument of type {type(scale)} cannot be safely cast to type {python_type}!",
      )
      torch._check(
          utils.is_weakly_lesser_type(type(alpha), python_type),
          lambda: f"alpha argument of type {type(alpha)} cannot be safely cast to type {python_type}!",
      )
  
      return torch.where(
          a > 0,
          scale * a,
          (alpha * scale) * torch.expm1(a * input_scale),
      )
  
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 6 for calling a global function with example usage: elu(a, alpha, scale, input_scale, inplace) and returns: torch