code: def _bias_mod_and_validity(bias, Cout, pattern):
      # check if the bias is compatible for fusion
      is_bias_scalar = True
      if isinstance(bias, np.ndarray):
          if bias.shape == ():
              bias = bias.tolist()
          elif np.prod(bias.shape) == 1:
              bias = np.squeeze(bias).tolist()
          else:
              is_bias_scalar = False
  
      if not is_bias_scalar:
          if np.prod(bias.shape) != Cout:
              return None
          rank = pattern.transpose.outputs[0].rank
          cout_dim = pattern.transpose.perm.val.tolist().index(1) - rank
          if bias.shape[cout_dim] != Cout:
              return None
          bias = np.reshape(bias, (Cout))
  
      return bias
  
file_path: coremltools/coremltools/converters/mil/experimental/passes/generic_conv_bias_fusion.py
imports: import os
  import numpy
  from coremltools import _logger
  from coremltools.converters.mil import Builder
  from coremltools.converters.mil.experimental.passes.generic_pass_infrastructure import register_generic_pass
  from coremltools.converters.mil.mil import types
label_desc: Use image node_id 6 for calling a global function with example usage: _bias_mod_and_validity(bias, Cout, pattern) and returns: bias, None, None