code: def _bn_scale_fusion(bn_idx, scale_idx, layers):
      bn = layers[bn_idx].batchnorm
      scale = layers[scale_idx].scale
  
      gamma = _np.array(bn.gamma.floatValue)
      beta = _np.array(bn.beta.floatValue)
      sw = _np.array(scale.scale.floatValue)
  
      gamma = gamma * sw
      beta = beta * sw
  
      if scale.hasBias:
          sb = _np.array(scale.bias.floatValue)
          beta = beta + sb
  
      del bn.gamma.floatValue[:]
      del bn.beta.floatValue[:]
  
      bn.gamma.floatValue.extend(gamma)
      bn.beta.floatValue.extend(beta)
  
      # re-wire outputs and delete scale layer
      print(
          "Fused {}->{}".format(
              layers[bn_idx].name, layers[scale_idx].name
          )
      )
      del layers[bn_idx].output[:]
      layers[bn_idx].output.extend(layers[scale_idx].output)
      del layers[scale_idx]
  
imports: import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: _bn_scale_fusion(bn_idx, scale_idx, layers) without return types