class_docstr: An abstract helper for merging a single-child with its single-parent.
class_docstr_tok: ["An","abstract","helper","for","merging","a","single-child","with","its","single-parent","."]
code: def __call__(self, graph):
      nodes = graph.nodes
      fused_nodes = []
      for node in nodes:
          if len(node.parents) != 1:
              # We're only fusing nodes with single parents
              continue
          parent, from_output = node.get_only_parent()
          if len(parent.children) != 1:
              # We can only fuse a node if its parent's
              # value isn't used by any other node.
              continue
          if not self.is_eligible_pair(parent, node):
              continue
          # Rewrite the fused node's children to its parent.
          for child in node.children:
              index = [
                  n
                  for n, (input, idx) in enumerate(child.parents)
                  if input == node
              ][0]
              child.parents.pop(index)
              child.add_parent(parent, from_output, index)
          # Disconnect the fused node from the graph.
          parent.children.remove(node)
          fused_nodes.append(node)
          # Let the sub-class merge the fused node in any arbitrary way.
          self.merge(parent, node)
      transformed_nodes = [
          node for node in nodes if node not in fused_nodes
      ]
      return graph.replaced(transformed_nodes)
  
imports: from __future__ import unicode_literals
  from google.protobuf import text_format
  import numpy
  from mmdnn.conversion.caffe.graph import GraphBuilder, NodeKind, LAYER_IN_TRAIN_PROTO
  from mmdnn.conversion.caffe.mapper import NodeMapper, get_handler_name
  from mmdnn.conversion.caffe.resolver import get_caffe_resolver, has_pycaffe
  from mmdnn.conversion.caffe.errors import print_stderr, ConversionError
  from mmdnn.conversion.caffe.common_graph import Graph
  from mmdnn.conversion.caffe.utils import get_lower_case, get_upper_case
label_desc: Use image node_id 1 for calling the SubNodeFuser obj's underlying member method code with example usage: obj.__call__(graph) and returns: graph