class_docstr: References
  ----------
  * https://github.com/onnx/onnx/blob/master/docs/Operators.md
class_docstr_tok: ["References","--","--","--","--","--","*","https",":","\/\/github.com\/onnx\/onnx\/blob\/master\/docs\/Operators.md"]
docstr: Starting from a Gemm node, consume nodes to form a dense aAB + bC node.
docstr_tok: ["Starting","from","a","Gemm","node",",","consume","nodes","to","form","a","dense","aAB","+","bC","node","."]
code: def _consume_gemm_dense_nodes(self, node, next_nodes):
      """Starting from a Gemm node, consume nodes to form a dense aAB + bC node."""
      if node.op_type != "Gemm":
          raise ValueError(
              f"{node.name} is a {node.op_type} node, only Gemm nodes can be used as starting points for consumption."
          )
      if len(node.input) != 3:
          raise ValueError(
              f"{node.name} input has {len(node.input)} dimensions, only nodes with 3 input dimensions can be used as starting points for consumption."
          )
  
      attr = _collect_attributes(node)
      alpha = attr["alpha"]
      beta = attr["beta"]
      [in_0, in_1, in_2] = list(node.input)
      input_layer, transformer = self._node_input_and_transformer(in_0)
      weights = self._initializers[in_1]
      # transpose B
      if attr["transB"] == 1:
          weights = np.transpose(weights)
      biases = self._initializers[in_2]
  
      input_output_size = _get_input_output_size(
          input_layer, transformer
      )
  
      # output is the same size as input except for the last dimension
      output_size = input_output_size[:-1] + [weights.shape[1]]
  
      activation = "linear"
      if len(next_nodes) == 1:
          # check if Relu
          type_, maybe_node, maybe_next_nodes = self._nodes[
              next_nodes[0]
          ]
          if maybe_node.op_type in _ACTIVATION_OP_TYPES:
              node = maybe_node
              activation = node.op_type.lower()
              next_nodes = maybe_next_nodes
  
      weights = weights * alpha
      biases = beta * biases
  
      dense_layer = DenseLayer(
          input_output_size,
          output_size,
          weights,
          biases,
          activation=activation,
          input_index_mapper=transformer,
      )
      self._node_map[node.name] = dense_layer
      self._node_map[node.output[0]] = dense_layer
  
      return next_nodes, dense_layer, [input_layer]
  
file_path: OMLT/src/omlt/io/onnx_parser.py
imports: import math
  import numpy
  from onnx import numpy_helper
  from omlt.neuralnet.layer import ConvLayer2D, DenseLayer, IndexMapper, InputLayer, PoolingLayer2D
  from omlt.neuralnet.network_definition import NetworkDefinition
label_desc: Use image node_id 6 for calling the NetworkParser obj's underlying member method code with example usage: obj._consume_gemm_dense_nodes(node, next_nodes) and returns: next_nodes,  dense_layer,  list