parameters: (op_type)
return_statement: return func
docstring: Register the Python layer for an Operator without Attribute.
  
      Args:
         op_type: The name of the operator to be created.
  
      This function takes in the operator type (sigmoid, exp , tanh etc) and
      creates the operator functionality.
docstring_summary: Register the Python layer for an Operator without Attribute.
docstring_tokens: Register the Python layer for an Operator without Attribute .
function: def generate_activation_fn(op_type):
      """Register the Python layer for an Operator without Attribute.
  
      Args:
         op_type: The name of the operator to be created.
  
      This function takes in the operator type (sigmoid, exp , tanh etc) and
      creates the operator functionality.
  
      """
      op_proto = OpProtoHolder.instance().get_op_proto(op_type)
  
      def func(x, name=None):
          if in_dygraph_mode():
              op = getattr(_C_ops, op_type)
              return op(x)
  
          if op_type not in ["abs", "exp", "square"]:
              check_variable_and_dtype(x, 'x', ['float16', 'float32', 'float64'],
                                       op_type)
          else:
              # abs exp square ops support dtype(int32, int64, float16, float32, float64)
              check_variable_and_dtype(
                  x, 'x', ['int32', 'int64', 'float16', 'float32', 'float64'],
                  op_type)
  
          helper = LayerHelper(op_type, **locals())
  
          output = helper.create_variable_for_type_inference(dtype=x.dtype)
          helper.append_op(type=op_type, inputs={"X": x}, outputs={"Out": output})
          return output
  
      func.__name__ = op_type
      func.__doc__ = _generate_doc_string_(
          op_proto,
          additional_args_lines=[
              "name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`."
          ])
      return func
function_tokens: def generate_activation_fn ( op_type ) : op_proto = OpProtoHolder . instance ( ) . get_op_proto ( op_type ) def func ( x , name = None ) : if in_dygraph_mode ( ) : op = getattr ( _C_ops , op_type ) return op ( x ) if op_type not in [ "abs" , "exp" , "square" ] : check_variable_and_dtype ( x , 'x' , [ 'float16' , 'float32' , 'float64' ] , op_type ) else : # abs exp square ops support dtype(int32, int64, float16, float32, float64) check_variable_and_dtype ( x , 'x' , [ 'int32' , 'int64' , 'float16' , 'float32' , 'float64' ] , op_type ) helper = LayerHelper ( op_type , * * locals ( ) ) output = helper . create_variable_for_type_inference ( dtype = x . dtype ) helper . append_op ( type = op_type , inputs = { "X" : x } , outputs = { "Out" : output } ) return output func . __name__ = op_type func . __doc__ = _generate_doc_string_ ( op_proto , additional_args_lines = [ "name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`." ] ) return func