docstr: Returns:
  
  index (int) of target_op in self.operations if target_op not None,
  undefined otherwise.
  
  Raises:
  
  ValueError if target_op not None and not found in self.operations.
  
  visible_vars: set[Var]
      Vars returned by ops in the block (self) visible (and equal to
      if inclusive==True) target_op.  If target_op is not found or None,
      include all vars output by self.operations. Examples:
  
  #    main(%a: (1, 2, fp32),
  #         %b: (1, 2, fp32),
  #         %c: (1, 2, fp32)) {
  #      block0() {
  #        %const1: (1, fp32) = const(...)
  #        %loop:0: (1, 2, fp32), %loop:1: (1, 2, fp32) =         #        while_loop(loop_vars=(%a, %b))
  #          loop_cond(%a.x, %b.x) {
  #            %blah: (bool) = some_op(x=%a.x, y=%b.x)
  #            %cond_var: (bool) = some_op2(x=%a.x, y=%blah)
  #          } -> (%cond_var)
  #          loop_body(%a.x, %b.x) {
  #            %add_0: (1, 2, fp32) = add(x=%a.x, y=%b.x)
  #          } -> (%add_0, %b.x)
  #        %linear: (1, fp32) = linear(...)
  #      } -> (%loop:0, %loop:1)
  #    }
  #
  
  Let V0 and V1 be the set of internal_vars of block0 and loop_cond
  block that supplies const vals (for const).
  
  Ex1: self = block0, target_op = linear.
  idx = 2
  visible_vars = {%const1, %loop:0, %loop:1, %linear, V0}
  
  Ex2: self = loop_cond, target_op = None.
  idx = undefined
  visible_vars = {%a.x, %b.x, %blah, %cond_var, V1}
  
  Ex3: self = loop_cond, target_op = some_op.
  idx = 0
  visible_vars = {%a.x, %b.x, %blah, V1}
  
  Ex4: self = loop_cond, target_op = linear.
  raises ValueError (linear not found in loop_cond block)
docstr_tok: ["Returns",":","index","(","int",")","of","target_op","in","self.operations","if","target_op","not","None",",","undefined","otherwise",".","Raises",":","ValueError","if","target_op","not","None","and","not","found","in","self.operations",".","visible_vars",":","set","[","Var","]","Vars","returned","by","ops","in","the","block","(","self",")","visible","(","and","equal","to","if","inclusive==True",")","target_op",".","If","target_op","is","not","found","or","None",",","include","all","vars","output","by","self.operations",".","Examples",":","#","main","(","%","a",":","(","1",",","2",",","fp32",")",",","#","%","b",":","(","1",",","2",",","fp32",")",",","#","%","c",":","(","1",",","2",",","fp32",")",")","{","#","block0","(",")","{","#","%","const1",":","(","1",",","fp32",")","=","const","(","...",")","#","%","loop:0",":","(","1",",","2",",","fp32",")",",","%","loop:1",":","(","1",",","2",",","fp32",")","=","#","while_loop","(","loop_vars=","(","%","a",",","%","b",")",")","#","loop_cond","(","%","a.x",",","%","b.x",")","{","#","%","blah",":","(","bool",")","=","some_op","(","x=","%","a.x",",","y=","%","b.x",")","#","%","cond_var",":","(","bool",")","=","some_op2","(","x=","%","a.x",",","y=","%","blah",")","#","}","-",">","(","%","cond_var",")","#","loop_body","(","%","a.x",",","%","b.x",")","{","#","%","add_0",":","(","1",",","2",",","fp32",")","=","add","(","x=","%","a.x",",","y=","%","b.x",")","#","}","-",">","(","%","add_0",",","%","b.x",")","#","%","linear",":","(","1",",","fp32",")","=","linear","(","...",")","#","}","-",">","(","%","loop:0",",","%","loop:1",")","#","}","#","Let","V0","and","V1","be","the","set","of","internal_vars","of","block0","and","loop_cond","block","that","supplies","const","vals","(","for","const",")",".","Ex1",":","self","=","block0",",","target_op","=","linear",".","idx","=","2","visible_vars","=","{","%","const1",",","%","loop:0",",","%","loop:1",",","%","linear",",","V0","}","Ex2",":","self","=","loop_cond",",","target_op","=","None",".","idx","=","undefined","visible_vars","=","{","%","a.x",",","%","b.x",",","%","blah",",","%","cond_var",",","V1","}","Ex3",":","self","=","loop_cond",",","target_op","=","some_op",".","idx","=","0","visible_vars","=","{","%","a.x",",","%","b.x",",","%","blah",",","V1","}","Ex4",":","self","=","loop_cond",",","target_op","=","linear",".","raises","ValueError","(","linear","not","found","in","loop_cond","block",")"]
code: def _visible_vars_in_block(self, target_op=None, inclusive=True):
      """
          Returns:
  
          index (int) of target_op in self.operations if target_op not None,
          undefined otherwise.
  
          Raises:
  
          ValueError if target_op not None and not found in self.operations.
  
          visible_vars: set[Var]
              Vars returned by ops in the block (self) visible (and equal to
              if inclusive==True) target_op.  If target_op is not found or None,
              include all vars output by self.operations. Examples:
  
          #    main(%a: (1, 2, fp32),
          #         %b: (1, 2, fp32),
          #         %c: (1, 2, fp32)) {
          #      block0() {
          #        %const1: (1, fp32) = const(...)
          #        %loop:0: (1, 2, fp32), %loop:1: (1, 2, fp32) = \
          #        while_loop(loop_vars=(%a, %b))
          #          loop_cond(%a.x, %b.x) {
          #            %blah: (bool) = some_op(x=%a.x, y=%b.x)
          #            %cond_var: (bool) = some_op2(x=%a.x, y=%blah)
          #          } -> (%cond_var)
          #          loop_body(%a.x, %b.x) {
          #            %add_0: (1, 2, fp32) = add(x=%a.x, y=%b.x)
          #          } -> (%add_0, %b.x)
          #        %linear: (1, fp32) = linear(...)
          #      } -> (%loop:0, %loop:1)
          #    }
          #
  
          Let V0 and V1 be the set of internal_vars of block0 and loop_cond
          block that supplies const vals (for const).
  
          Ex1: self = block0, target_op = linear.
          idx = 2
          visible_vars = {%const1, %loop:0, %loop:1, %linear, V0}
  
          Ex2: self = loop_cond, target_op = None.
          idx = undefined
          visible_vars = {%a.x, %b.x, %blah, %cond_var, V1}
  
          Ex3: self = loop_cond, target_op = some_op.
          idx = 0
          visible_vars = {%a.x, %b.x, %blah, V1}
  
          Ex4: self = loop_cond, target_op = linear.
          raises ValueError (linear not found in loop_cond block)
          """
      visible_vars = set(self._internal_vars)
      visible_vars.update(self.inputs)
      idx = -1
      # find the location of target_op
      for i, op in enumerate(self.operations):
          if op == target_op:
              if inclusive:
                  visible_vars.update(op.outputs)
              return i, visible_vars
          visible_vars.update(op.outputs)
      if target_op is not None:
          msg = "Op {} not found in {}: {}"
          raise ValueError(msg.format(target_op.name, self.name, self))
      return idx, visible_vars
  
imports: from collections import Counter, OrderedDict
  import copy
  import logging
  import numpy
  from six import string_types
  from .None import SPACES, types
  from .var import Var, InternalVar, ListVar
  from .visitors.dot_visitor import DotVisitor
  from .types.symbolic import k_used_symbols, k_num_internal_syms, any_symbolic, is_symbolic
  from .input_type import TupleInputType
label_desc: Use image node_id 12 for calling the Block obj's underlying member method code with example usage: obj._visible_vars_in_block(target_op, inclusive) and returns: idx,  visible_vars, i,  visible_vars