code: def save_alpha_pred(alpha, path):
      """
      The value of alpha is range [0, 1], shape should be [h,w]
      """
      dirname = os.path.dirname(path)
      if not os.path.exists(dirname):
          os.makedirs(dirname)
  
      alpha = (alpha).astype("uint8")
      cv2.imwrite(path, alpha)
  
file_path: PaddleSeg/Matting/ppmatting/core/val_ml.py
imports: import os
  import cv2
  import numpy
  import time
  import paddle
  import paddle.nn.functional
  from paddleseg.utils import TimeAverager, calculate_eta, logger, progbar
  from ppmatting.metrics import metric
  from pymatting.util.util import load_image, save_image, stack_images
  from pymatting.foreground.estimate_foreground_ml import estimate_foreground_ml
label_desc: Use image node_id 1 for calling a global function with example usage: save_alpha_pred(alpha, path) without return types