code: def check_unary_ops():
      unary_ops = [
          "relu",
          "sigmoid",
          "softsign",
          "exp",
          "expm1",
          "log",
          "log10",
          "log2",
          "log1p",
          "degrees",
          "radians",
          "sin",
          "cos",
          "tan",
          "arcsin",
          "arccos",
          "arctan",
          "sinh",
          "cosh",
          "tanh",
          "arcsinh",
          "arctanh",
          "sqrt",
          "rsqrt",
          "cbrt",
          "rcbrt",
          "square",
          "squeeze",
          "zeros_like",
          "ones_like",
          "flatten",
          "round",
          "rint",
          "fix",
          "floor",
          "ceil",
          "trunc",
          "sign",
          "reciprocal",
          "abs",
          "gamma",
          "gammaln",
          "erf",
          "negative",
          "logical_not",
      ]
  
      def announce_check(op_name):
          print("Checking fusion of " + op_name)
  
      arr = mx.random.uniform(shape=rand_shape_2d())
      a = mx.sym.Variable("a")
      for op_name in unary_ops:
          announce_check(op_name)
          op = getattr(mx.sym, op_name)
          sym = op(a)
          check_fused_symbol(sym, a=arr)
  
      # unary ops requiring special treatment
  
      # arccosh needs input to be >= 1
      arr2 = arr + 1
      announce_check("arccosh")
      check_fused_symbol(mx.sym.arccosh(a), a=arr2)
  
      # erfinv needs -1 < input < 1, but we avoid the limits of this range where the slope nears +inf.
      arr2 = (arr - 0.5) * 1.99
      announce_check("erfinv")
      check_fused_symbol(mx.sym.erfinv(a), a=arr2)
  
      # Activation requires act_type attribute
      for act_type in [
          "relu",
          "sigmoid",
          "tanh",
          "softrelu",
          "softsign",
      ]:
          announce_check("Activation(act_type='{}')".format(act_type))
          check_fused_symbol(
              mx.sym.Activation(a, act_type=act_type), a=arr
          )
          if act_type == "softrelu":
              # Check that softrelu implementation doesn't overflow on large inputs
              check_fused_symbol(
                  mx.sym.Activation(a, act_type=act_type), a=1000 * arr
              )
  
      # Cast requires dtype
      for dtype in ["float16", "float32", "float64", "int32"]:
          announce_check("Cast(dtype='{}')".format(dtype))
          check_fused_symbol(mx.sym.Cast(a, dtype=dtype), a=arr)
  
      # reshape requires shape
      announce_check("reshape")
      check_fused_symbol(mx.sym.reshape(a, shape=(-1,)), a=arr)
  
      # expand_dims requires axis
      announce_check("expand_dims")
      check_fused_symbol(mx.sym.expand_dims(a, axis=1), a=arr)
  
      # clip requires a_min, a_max
      announce_check("clip")
      check_fused_symbol(mx.sym.clip(a, a_min=0.3, a_max=0.7), a=arr)
      check_fused_symbol(
          mx.sym.clip(a, a_min=-np.inf, a_max=0.7), a=arr
      )
      check_fused_symbol(
          mx.sym.clip(a, a_min=-np.inf, a_max=np.inf), a=arr
      )
      check_fused_symbol(mx.sym.clip(a, a_min=0, a_max=np.nan), a=arr)
  
      # smooth_l1 requires a scalar
      announce_check("smooth_l1")
      check_fused_symbol(mx.sym.smooth_l1(a, scalar=0.3), a=arr)
  
file_path: mxnet/tests/python/gpu/test_fusion.py
imports: import sys
  import os
  import random
  import itertools
  import mxnet
  import numpy
  from mxnet import autograd, gluon
  from mxnet.test_utils import *
label_desc: Use image node_id 2 for calling a global function with example usage: check_unary_ops() without return types