code: def draw(X, pred, means, covariances, output):
      xp = cupy.get_array_module(X)
      for i in range(2):
          labels = X[pred == i]
          if xp is cupy:
              labels = labels.get()
          plt.scatter(
              labels[:, 0], labels[:, 1], c=np.random.rand(1, 3)
          )
      if xp is cupy:
          means = means.get()
          covariances = covariances.get()
      plt.scatter(
          means[:, 0],
          means[:, 1],
          s=120,
          marker="s",
          facecolors="y",
          edgecolors="k",
      )
      x = np.linspace(-5, 5, 1000)
      y = np.linspace(-5, 5, 1000)
      X, Y = np.meshgrid(x, y)
      for i in range(2):
          dist = stats.multivariate_normal(means[i], covariances[i])
          Z = dist.pdf(np.stack([X, Y], axis=-1))
          plt.contour(X, Y, Z)
      plt.savefig(output)
  
file_path: cupy/examples/gmm/gmm.py
imports: import argparse
  import contextlib
  import time
  import matplotlib.pyplot
  import numpy
  from scipy import stats
  import cupy
label_desc: Use image node_id 8 for calling a global function with example usage: draw(X, pred, means, covariances, output) without return types