class_docstr: Functor for translating Relay programs into Python ASTs.
class_docstr_tok: ["Functor","for","translating","Relay","programs","into","Python","ASTs","."]
docstr: This method converts the passed Relay expression into a Python
  AST object with equivalent semantics.
  
  The Python AST can be executed using exec(); it can be turned
  into text and inspected using astor.
docstr_tok: ["This","method","converts","the","passed","Relay","expression","into","a","Python","AST","object","with","equivalent","semantics",".","The","Python","AST","can","be","executed","using","exec","(",")",";","it","can","be","turned","into","text","and","inspected","using","astor","."]
code: def convert(self, prog: Expr):
      """This method converts the passed Relay expression into a Python
      AST object with equivalent semantics.
  
      The Python AST can be executed using exec(); it can be turned
      into text and inspected using astor.
      """
      optimized = self.optimize(prog)
  
      # start with conversion prelude (imports) and convert global defs
      body = []
      body += PROLOGUE
      body += self.convert_module()
  
      prog_body, extra_defs = self.visit(optimized)
      body += extra_defs
  
      # we finally must assign the final expression to the output var
      # so it can be read after running EXEC
      body.append(Assign([Name(OUTPUT_VAR_NAME, Store())], prog_body))
      global __MAJOR__, __MINOR__
  
      if __MAJOR__ == 3 and __MINOR__ >= 8:
          return ast.fix_missing_locations(
              ast.Module(body=body, type_ignores=[])
          )
      else:
          return ast.fix_missing_locations(ast.Module(body=body))
  
imports: import sys
  import ast
  from ast import alias, Assign, Load, Name, NameConstant, Num, Return, Store, Str
  import re
  import tvm
  from tvm import relay
  from tvm.relay.adt import Pattern
  from tvm.relay.backend import te_compiler
  from tvm.relay.expr import Expr, GlobalVar, Var
  from tvm.relay.function import Function
  from tvm.relay.expr_functor import ExprFunctor
label_desc: Use image node_id 2 for calling the PythonConverter obj's underlying member method code with example usage: obj.convert(prog) and returns: ast, ast