code: def var_constraints(pattern):
      passed = True
      passed = (
          passed
          and pattern.scale.x.val is not None
          or pattern.scale.y.val is not None
      )
      passed = passed and pattern.conv.weight.val is not None
  
      is_scalar = _is_scalar(pattern)
      Cin, Cout = _cin_cout(pattern)
      scale_var = (
          pattern.scale.x
          if pattern.scale.x.val is not None
          else pattern.scale.y
      )
      scale = scale_var.val
  
      # for the vector scale case, check if the shape is broacastable
      if not is_scalar:
          conv_weight = pattern.conv.weight.val
          passed = passed and (
              np.product(scale.shape) == Cout
              or (
                  len(scale.shape) == len(conv_weight.shape)
                  and scale.shape[1] == Cout
              )
              or (
                  len(scale.shape) == len(conv_weight.shape) - 1
                  and scale.shape[0] == Cout
              )
          )
  
      return passed
  
file_path: coremltools/coremltools/converters/mil/experimental/passes/generic_conv_scale_fusion.py
imports: import os
  import numpy
  from coremltools.converters.mil import Builder
  from coremltools.converters.mil.experimental.passes.generic_pass_infrastructure import register_generic_pass
label_desc: Use image node_id 3 for calling a global function with example usage: var_constraints(pattern) and returns: passed