code: def tensor_array_resource_removal(gd):
      # this should be called *BEFORE* introduction of tuples,
      # and before output edges are added (for simplicity)
      for k, node in gd.items():
          if (
              node.op.startswith("TensorArray")
              and node.op != "TensorArrayV3"
          ):
              # generally the resource edge is the first edge
              # input is resource, indices, flow
              # output is generally flow
              node.inputs = node.inputs[1:]
  
          # TensorArrayV3 node outputs resource and flow
          # shift all flow reads from TensorArray to output 0 of TensorArray
          for i in range(len(node.inputs)):
              if ":" in node.inputs[i]:
                  input_node, input_index = node.inputs[i].split(":")
                  input_index = int(input_index)
              else:
                  input_node = node.inputs[i]
                  input_index = 0
              if gd[input_node].op == "TensorArrayV3":
                  if input_index == 1:
                      node.inputs[i] = "%s" % input_node
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
label_desc: Use image node_id 1 for calling a global function with example usage: tensor_array_resource_removal(gd) without return types