class_docstr: Fuses Reshape operator if it is used only to reshape blob in
  graph initializer. We can reshape here instead of runtime.
class_docstr_tok: ["Fuses","Reshape","operator","if","it","is","used","only","to","reshape","blob","in","graph","initializer",".","We","can","reshape","here","instead","of","runtime","."]
code: def __call__(self, graph):  # type: (Graph) -> Graph
      nodes = graph.nodes
      removed = []
      for node in nodes:
          if node.op_type != "Reshape":
              continue
          if not (
              len(node.input_tensors) == 2
              or len(node.input_tensors) == 1
          ):
              continue
          tensor_name = node.inputs[0]
          if tensor_name not in node.input_tensors:
              continue
          if len(node.inputs) > 1:
              shape_name = node.inputs[1]
              if shape_name not in node.input_tensors:
                  continue
          is_non_constant_parent = False
          if len(node.parents) > 0:
              for parent in node.parents:
                  if parent.op_type != "Constant":
                      is_non_constant_parent = True
                      break
          if is_non_constant_parent:
              continue
  
          removed.append(node)
          output_name = node.outputs[0]
  
          tensor = node.input_tensors[tensor_name]
          if "shape" in node.attrs:
              shape = tuple(node.attrs["shape"])
          else:
              shape = node.input_tensors[shape_name]  # type: ignore
  
          # ONNX spec supports setting dimension to '0', in which case
          # it should be taken from old dimension.
          # This isn't supported in numpy, so don't transform.
          # TODO Should we support this case?
          if any([s == 0 for s in shape]):
              continue
  
          reshaped_tensor = tensor.reshape(shape)
  
          for child in node.children:
              child.parents.remove(node)
              child.input_tensors[output_name] = reshaped_tensor
  
      transformed_nodes = [
          node for node in nodes if node not in removed
      ]
      return Graph(
          transformed_nodes,
          graph.inputs,
          graph.outputs,
          graph.shape_dict,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from typing import Sequence, Text, Dict, List
  import numpy
  from onnx import TensorProto
  from ._graph import Graph, Node
label_desc: Use image node_id 1 for calling the ReshapeInitTensorFuser obj's underlying member method code with example usage: obj.__call__(graph) and returns: Graph