(CommandList
  children: [
    (C {(set)} {(-u)})
    (FuncDef
      name: die
      body: 
        (BraceGroup
          children: [
            (C {(echo)} {($ VSub_At '$@')})
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [58]
        )
      spids: [54 57]
    )
    (C {(echo)} {(DQ ('Collecting system information...'))})
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:OUTPUT_FILE) op:Equal rhs:{(tf_env.txt)} spids:[97])]
      spids: [97]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:python_bin_path)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        ops: [Op_DPipe Op_DPipe]
                        children: [
                          (C {(which)} {(python)})
                          (C {(which)} {(python3)})
                          (C {(die)} {(DQ ('Cannot find Python binary'))})
                        ]
                      )
                    ]
                  )
                left_token: <Left_CommandSub '$('>
                spids: [101 119]
              )
            }
          spids: [100]
        )
      ]
      spids: [100]
    )
    (BraceGroup
      children: [
        (C {(echo)})
        (C {(echo)} {(DQ ('== cat /etc/issue ==============================================='))})
        (C {(uname)} {(-a)})
        (Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (LhsName name:uname)
              op: Equal
              rhs: 
                {
                  (CommandSubPart
                    command_list: (CommandList children:[(C {(uname)} {(-s)})])
                    left_token: <Left_Backtick '`'>
                    spids: [141 145]
                  )
                }
              spids: [140]
            )
          ]
          spids: [140]
        )
        (If
          arms: [
            (if_arm
              cond: [
                (Sentence
                  child: 
                    (C {(Lit_Other '[')} 
                      {
                        (DQ 
                          (CommandSubPart
                            command_list: (CommandList children:[(C {(uname)})])
                            left_token: <Left_CommandSub '$('>
                            spids: [153 155]
                          )
                        )
                      } {(Lit_Other '=') (Lit_Other '=')} {(DQ (Darwin))} {(Lit_Other ']')}
                    )
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [
                (C {(echo)} {(Mac)} {(OS)} {(X)} 
                  {
                    (CommandSubPart
                      command_list: (CommandList children:[(C {(sw_vers)} {(-productVersion)})])
                      left_token: <Left_Backtick '`'>
                      spids: [179 183]
                    )
                  }
                )
              ]
              spids: [16777215 168]
            )
            (if_arm
              cond: [
                (Sentence
                  child: 
                    (C {(Lit_Other '[')} 
                      {
                        (DQ 
                          (CommandSubPart
                            command_list: (CommandList children:[(C {(uname)})])
                            left_token: <Left_CommandSub '$('>
                            spids: [191 193]
                          )
                        )
                      } {(Lit_Other '=') (Lit_Other '=')} {(DQ (Linux))} {(Lit_Other ']')}
                    )
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [
                (Pipeline
                  children: [(C {(cat)} {(/etc/) (Lit_Other '*') (release)}) (C {(grep)} {(VERSION)})]
                  negated: F
                )
              ]
              spids: [186 206]
            )
          ]
          spids: [16777215 222]
        )
        (C {(echo)})
        (C {(echo)} {(SQ <'== are we in docker ============================================='>)})
        (Sentence
          child: 
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:num)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(cat)} {(/proc/1/cgroup)})
                                  (C {(grep)} {(docker)})
                                  (C {(wc)} {(-l)})
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_Backtick '`'>
                        spids: [238 254]
                      )
                    }
                  spids: [237]
                )
              ]
              spids: [237]
            )
          terminator: <Op_Semi ';'>
        )
        (If
          arms: [
            (if_arm
              cond: [
                (Sentence
                  child: (C {(Lit_Other '[')} {($ VSub_Name '$num')} {(-ge)} {(1)} {(Lit_Other ']')})
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [(C {(echo)} {(DQ (Yes))})]
              spids: [16777215 271]
            )
          ]
          else_action: [(C {(echo)} {(DQ (No))})]
          spids: [281 291]
        )
        (C {(echo)})
        (C {(echo)} {(SQ <'== compiler ====================================================='>)})
        (SimpleCommand
          words: [{(c) (Lit_Other '+') (Lit_Other '+')} {(--version)}]
          redirects: [(Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[312])]
        )
        (C {(echo)})
        (C {(echo)} {(SQ <'== uname -a ====================================================='>)})
        (C {(uname)} {(-a)})
        (C {(echo)})
        (C {(echo)} {(SQ <'== check pips ==================================================='>)})
        (Pipeline
          children: [
            (SimpleCommand
              words: [{(pip)} {(list)}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[349])]
            )
            (C {(grep)} {(DQ (proto) (Lit_Other '\\') ('|numpy') (Lit_Other '\\') ('|tensorflow'))})
          ]
          negated: F
        )
        (C {(echo)})
        (C {(echo)} {(SQ <'== check for virtualenv ========================================='>)})
        (C {(${ VSub_Name python_bin_path)} {(-c)} 
          {
            (DQ ('import sys;print(hasattr(sys, ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) 
              (real_prefix) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('))')
            )
          }
        )
        (C {(echo)})
        (C {(echo)} {(SQ <'== tensorflow import ============================================'>)})
      ]
      redirects: [
        (Redir
          op_id: Redir_DGreat
          fd: 16777215
          arg_word: {(${ VSub_Name OUTPUT_FILE)}
          spids: [407]
        )
      ]
      spids: [122]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {
              (DQ ('import tensorflow as tf;\n') ('print(') (Right_DoubleQuote '"') ('tf.VERSION = %s') 
                (Right_DoubleQuote '"') (' % tf.VERSION)\n') ('print(') (Right_DoubleQuote '"') ('tf.GIT_VERSION = %s') (Right_DoubleQuote '"') 
                (' % tf.GIT_VERSION)\n') ('print(') (Right_DoubleQuote '"') ('tf.COMPILER_VERSION = %s') (Right_DoubleQuote '"') 
                (' % tf.GIT_VERSION)\n') ('with tf.Session() as sess:\n') ('  print(') (Right_DoubleQuote '"') ('Sanity check: %r') 
                (Right_DoubleQuote '"') (' % sess.run(tf.constant([1,2,3])[:1]))\n')
              )
            }
          do_expansion: True
          here_end: EOF
          was_filled: T
          spids: [416]
        )
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(/tmp/check_tf.py)} spids:[419])
      ]
    )
    (SimpleCommand
      words: [{(${ VSub_Name python_bin_path)} {(/tmp/check_tf.py)}]
      redirects: [
        (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[452])
        (Redir
          op_id: Redir_DGreat
          fd: 16777215
          arg_word: {(${ VSub_Name OUTPUT_FILE)}
          spids: [455]
        )
      ]
    )
    (SimpleCommand
      words: [{(${ VSub_Name python_bin_path)} {(-c)} {(DQ ('import tensorflow'))}]
      redirects: [
        (Redir op_id:Redir_DGreat fd:2 arg_word:{(${ VSub_Name OUTPUT_FILE)} spids:[475])
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(/tmp/loadedlibs)} spids:[480])
      ]
      more_env: [(env_pair name:DEBUG_LD val:{(libs)} spids:[462])]
    )
    (BraceGroup
      children: [
        (C {(grep)} {(libcudnn.so)} {(/tmp/loadedlibs)})
        (C {(echo)})
        (C {(echo)} {(SQ <'== env =========================================================='>)})
        (If
          arms: [
            (if_arm
              cond: [
                (Sentence
                  child: 
                    (C {(Lit_Other '[')} {(-z)} 
                      {
                        (BracedVarSub
                          token: <VSub_Name LD_LIBRARY_PATH>
                          suffix_op: (StringUnary op_id:VTest_Plus arg_word:{(x)})
                          spids: [511 515]
                        )
                      } {(Lit_Other ']')}
                    )
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [
                (Sentence
                  child: (C {(echo)} {(DQ ('LD_LIBRARY_PATH is unset'))})
                  terminator: <Op_Semi ';'>
                )
              ]
              spids: [16777215 520]
            )
          ]
          else_action: [
            (Sentence
              child: (C {(echo)} {(LD_LIBRARY_PATH)} {(${ VSub_Name LD_LIBRARY_PATH)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [531 545]
        )
        (If
          arms: [
            (if_arm
              cond: [
                (Sentence
                  child: 
                    (C {(Lit_Other '[')} {(-z)} 
                      {
                        (BracedVarSub
                          token: <VSub_Name DYLD_LIBRARY_PATH>
                          suffix_op: (StringUnary op_id:VTest_Plus arg_word:{(x)})
                          spids: [554 558]
                        )
                      } {(Lit_Other ']')}
                    )
                  terminator: <Op_Semi ';'>
                )
              ]
              action: [
                (Sentence
                  child: (C {(echo)} {(DQ ('DYLD_LIBRARY_PATH is unset'))})
                  terminator: <Op_Semi ';'>
                )
              ]
              spids: [16777215 563]
            )
          ]
          else_action: [
            (Sentence
              child: (C {(echo)} {(DYLD_LIBRARY_PATH)} {(${ VSub_Name DYLD_LIBRARY_PATH)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [574 588]
        )
        (C {(echo)})
        (C {(echo)} {(SQ <'== nvidia-smi ==================================================='>)})
        (SimpleCommand
          words: [{(nvidia-smi)}]
          redirects: [(Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[607])]
        )
        (C {(echo)})
        (C {(echo)} {(SQ <'== cuda libs  ==================================================='>)})
      ]
      redirects: [
        (Redir
          op_id: Redir_DGreat
          fd: 16777215
          arg_word: {(${ VSub_Name OUTPUT_FILE)}
          spids: [624]
        )
      ]
      spids: [485]
    )
    (Pipeline
      children: [
        (SimpleCommand
          words: [{(find)} {(/usr/local)} {(-type)} {(f)} {(-name)} {(SQ <'libcudart*'>)}]
          redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[645])]
        )
        (C {(grep)} {(cuda)})
        (SimpleCommand
          words: [{(grep)} {(-v)} {(DQ (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) (.cache))}]
          redirects: [
            (Redir
              op_id: Redir_DGreat
              fd: 16777215
              arg_word: {(${ VSub_Name OUTPUT_FILE)}
              spids: [665]
            )
          ]
        )
      ]
      negated: F
    )
    (Pipeline
      children: [
        (SimpleCommand
          words: [{(find)} {(/usr/local)} {(-type)} {(f)} {(-name)} {(SQ <'libudnn*'>)}]
          redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[685])]
        )
        (C {(grep)} {(cuda)})
        (SimpleCommand
          words: [{(grep)} {(-v)} {(DQ (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) (.cache))}]
          redirects: [
            (Redir
              op_id: Redir_DGreat
              fd: 16777215
              arg_word: {(${ VSub_Name OUTPUT_FILE)}
              spids: [705]
            )
          ]
        )
      ]
      negated: F
    )
    (C {(mv)} {($ VSub_Name '$OUTPUT_FILE')} {(old-) ($ VSub_Name '$OUTPUT_FILE')})
    (SimpleCommand
      words: [{(grep)} {(-v)} {(-i)} {(google)} {(old-) (${ VSub_Name OUTPUT_FILE)}]
      redirects: [
        (Redir
          op_id: Redir_Great
          fd: 16777215
          arg_word: {($ VSub_Name '$OUTPUT_FILE')}
          spids: [735]
        )
      ]
    )
    (C {(echo)} 
      {
        (DQ ('Wrote environment to ') (${ VSub_Name OUTPUT_FILE) 
          ('. You can review the contents of that file.')
        )
      }
    )
    (C {(echo)} {(DQ ('and use it to populate the fields in the github issue template.'))})
    (C {(echo)})
    (C {(echo)} {(DQ ('cat ') (${ VSub_Name OUTPUT_FILE))})
    (C {(echo)})
  ]
)