code: def perlin_ms(octaves, width, height, grayscale):
      out_array = [0.5] if grayscale else [0.5, 0.5, 0.5]
      # out_array = [0.0] if grayscale else [0.0, 0.0, 0.0]
      for i in range(1 if grayscale else 3):
          scale = 2 ** len(octaves)
          oct_width = width
          oct_height = height
          for oct in octaves:
              p = perlin(oct_width, oct_height, scale)
              out_array[i] += p * oct
              scale //= 2
              oct_width *= 2
              oct_height *= 2
      return paddle.concat(out_array)
  
file_path: PaddleHub/modules/image/text_to_image/disco_diffusion_ernievil_base/reverse_diffusion/model/perlin_noises.py
imports: import numpy
  import paddle
  import paddle.vision.transforms
  from PIL import Image
  from PIL import ImageOps
label_desc: Use image node_id 3 for calling a global function with example usage: perlin_ms(octaves, width, height, grayscale) and returns: paddle