docstr: Checks if a var is visible to ops starting from id=`upto_op_with_id` inside the block.
  
  Var is visible if
  - It is the output of a const op, or
  - It is the output of "preceding" operations in that block, or
  - It is visible in the enclosing block, or
  - It is either a block or a function input
  
  If upto_op_with_id is None, outputs of all operations inside the block are visible to
  that block.
docstr_tok: ["Checks","if","a","var","is","visible","to","ops","starting","from","id=","`","upto_op_with_id","`","inside","the","block",".","Var","is","visible","if","-","It","is","the","output","of","a","const","op",",","or","-","It","is","the","output","of","``","preceding","''","operations","in","that","block",",","or","-","It","is","visible","in","the","enclosing","block",",","or","-","It","is","either","a","block","or","a","function","input","If","upto_op_with_id","is","None",",","outputs","of","all","operations","inside","the","block","are","visible","to","that","block","."]
code: def is_var_visible_in_block(self, var, upto_op_with_id=None):
      """
      Checks if a var is visible to ops starting from id=`upto_op_with_id` inside the block.
  
      Var is visible if
      - It is the output of a const op, or
      - It is the output of "preceding" operations in that block, or
      - It is visible in the enclosing block, or
      - It is either a block or a function input
  
      If upto_op_with_id is None, outputs of all operations inside the block are visible to
      that block.
      """
  
      if var in self._internal_vars:
          return True
  
      inputs = (
          self.function_inputs
          if isinstance(self, Function)
          else self.inputs
      )
      if var in inputs:
          return True
  
      idx = (
          len(self.operations)
          if upto_op_with_id is None
          else upto_op_with_id
      )
  
      for i in range(idx - 1, -1, -1):
          op_outputs = self.operations[i].outputs
          if op_outputs is not None and var in op_outputs:
              return True
  
      if self.outer_op is not None:
          enclosing_block = self.outer_op.enclosing_block
          outer_op_id = enclosing_block.find_op_id_in_block(
              self.outer_op
          )
          if enclosing_block.is_var_visible_in_block(
              var, upto_op_with_id=outer_op_id
          ):
              return True
  
      return False
  
imports: import copy
  from collections import Counter, OrderedDict
  from typing import Tuple
  from coremltools import _OPSET
  from coremltools import _logger
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from .None import SPACES, types
  from .operation import Operation
  from .types.symbolic import is_symbolic, k_used_symbols
  from .var import ComplexVar, InternalVar, Var
  from .visitors.dot_visitor import DotVisitor
label_desc: Use image node_id 9 for calling the Block obj's underlying member method code with example usage: obj.is_var_visible_in_block(var, upto_op_with_id) and returns: False, True, True, True, True