code: def _erf_legalize(attrs, inputs, arg_types):
      """Legalizes ERF op if needed.
  
      Parameters
      ----------
      attrs : tvm.ir.Attrs
          Attributes of current convolution
      inputs : list of tvm.relay.Expr
          The args of the Relay expr to be legalized
      types : list of types
          List of input and output types
  
      Returns
      -------
      result : tvm.relay.Expr
          The legalized expr
      """
      # Extract types and expressions.
      data = inputs[0]
      data_tensor = arg_types[0]
      # Check if the input type is supported.
      data_dtype = data_tensor.dtype
      # If input is not fp32, we must cast to it.
      if data_dtype != "float32":
          data = relay.cast(data, "float32")
          output = relay.erf(data)
          return relay.cast(output, data_dtype)
  
      # Otherwise do nothing.
      return None
  
imports: import logging
  from tvm import relay
  from ..math import erf_legalize
label_desc: Use image node_id 1 for calling a global function with example usage: _erf_legalize(attrs, inputs, arg_types) and returns: None, relay