class_docstr: Temporarily changes the attr of an op.
class_docstr_tok: ["Temporarily","changes","the","attr","of","an","op","."]
docstr: Saves the required info for RAII pattern usage.
  
  Parameters
  ----------
  op_name : str
      The op name.
  
  attr_key : str
      The attribute name.
  
  attr_value : object
      The attribute value.
  
  Examples
  --------
  .. code-block:: python
  
  # Temporarily update FTVMAlterOpLayout to a user-defined packed function.
  # After the test is finished, the attr value will be set back to the original value.
  
  with TempOpAttr("nn.conv2d", "FTVMAlterOpLayout", alter_conv2d):
      my_mod = relay.transform.AlterOpLayout()(my_mod)
docstr_tok: ["Saves","the","required","info","for","RAII","pattern","usage",".","Parameters","--","--","--","--","--","op_name",":","str","The","op","name",".","attr_key",":","str","The","attribute","name",".","attr_value",":","object","The","attribute","value",".","Examples","--","--","--","--","..","code-block",":",":","python","#","Temporarily","update","FTVMAlterOpLayout","to","a","user-defined","packed","function",".","#","After","the","test","is","finished",",","the","attr","value","will","be","set","back","to","the","original","value",".","with","TempOpAttr","(","``","nn.conv2d","''",",","``","FTVMAlterOpLayout","''",",","alter_conv2d",")",":","my_mod","=","relay.transform.AlterOpLayout","(",")","(","my_mod",")"]
code: def __init__(self, op_name, attr_key, attr_value):
      """Saves the required info for RAII pattern usage.
  
      Parameters
      ----------
      op_name : str
          The op name.
  
      attr_key : str
          The attribute name.
  
      attr_value : object
          The attribute value.
  
      Examples
      --------
      .. code-block:: python
  
      # Temporarily update FTVMAlterOpLayout to a user-defined packed function.
      # After the test is finished, the attr value will be set back to the original value.
  
      with TempOpAttr("nn.conv2d", "FTVMAlterOpLayout", alter_conv2d):
          my_mod = relay.transform.AlterOpLayout()(my_mod)
  
      """
      self.op = relay.op.get(op_name)
      self.attr_key = attr_key
      self.attr_value = attr_value
  
imports: from tvm import relay
label_desc: Use image node_id 1 to create a new TempOpAttr object from inherited base classes: object with example: obj = TempOpAttr(op_name, attr_key, attr_value)