code: def view_tree_set(fgraph, v, treeset):
      """
      Add to `treeset` all variables that are views of v, given that v is
      not a view.
  
      """
      treeset.add(v)
      for cl, v_input_pos_to_cl in fgraph.clients[v]:
          if cl == "output":
              continue
          vmap = cl.op.view_map
          dmap = cl.op.destroy_map
          for opos, iposlist in chain(vmap.items(), dmap.items()):
              if v_input_pos_to_cl in iposlist:
                  if cl.outputs[opos] not in treeset:
                      view_tree_set(fgraph, cl.outputs[opos], treeset)
  
imports: import copy
  import copyreg
  import logging
  import time
  import warnings
  from itertools import chain
  from typing import TYPE_CHECKING, Optional
  import numpy
  import pytensor
  import pytensor.compile.profiling
  from pytensor.compile.io import In, SymbolicInput, SymbolicOutput
  from pytensor.compile.ops import deep_copy_op, view_op
  from pytensor.configdefaults import config
  from pytensor.graph.basic import Constant, Variable, ancestors, clone_get_equiv, graph_inputs
  from pytensor.graph.destroyhandler import DestroyHandler
  from pytensor.graph.features import AlreadyThere, Feature, PreserveVariableAttributes
  from pytensor.graph.fg import FunctionGraph
  from pytensor.graph.op import HasInnerGraph
  from pytensor.graph.utils import InconsistencyError, get_variable_trace_string
  from pytensor.link.basic import Container
  from pytensor.link.utils import raise_with_op
label_desc: Use image node_id 2 for calling a global function with example usage: view_tree_set(fgraph, v, treeset) without return types