code: def _fuse_layer_with_scale_layer(layer_idx, scale_idx, layers):
      layer_type = layers[layer_idx].WhichOneof("layer")
      if layer_type == "convolution":
          layer = layers[layer_idx].convolution
      elif layer_type == "innerProduct":
          layer = layers[layer_idx].innerProduct
      else:
          raise Exception(
              "Scale fusion not supper for layer "
              "type {} ".format(layer_type)
          )
  
      scale = layers[scale_idx].scale
  
      # Update weights
      sw = _np.array(scale.scale.floatValue)
      w = _np.array(layer.weights.floatValue)
      w = w.reshape(
          layer.outputChannels, int(len(w) / layer.outputChannels)
      )
      wp = w * sw[:, None]
      del layer.weights.floatValue[:]
      layer.weights.floatValue.extend(wp.flatten())
  
      # Update biases
      if scale.hasBias:
          sb = _np.array(scale.bias.floatValue)
          if not layer.hasBias:
              layer.bias.floatValue.extend(sb)
              layer.hasBias = True
          else:
              lb = _np.array(layer.bias.floatValue)
              bp = sw * lb + sb
              del layer.bias.floatValue[:]
              layer.bias.floatValue.extend(bp)
  
      # re-wire outputs and delete scale layer
      print(
          "Fused {}->{}".format(
              layers[layer_idx].name, layers[scale_idx].name
          )
      )
      del layers[layer_idx].output[:]
      layers[layer_idx].output.extend(layers[scale_idx].output)
      del layers[scale_idx]
  
imports: import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _fuse_layer_with_scale_layer(layer_idx, scale_idx, layers) without return types