code: def view_emb(emb, dir):
      """
      Visualize a embedding matrix.
  
      Args:
          emb (torch.tensor): Embedding matrix with shape (N, D). D is the
          feature dimension.
          dir (str): Output directory for the embedding figure.
  
      """
      if emb.shape[1] > 2:
          pca = PCA(n_components=2)
          emb = pca.fit_transform(emb)
      plt.figure(figsize=(10, 10))
      plt.scatter(emb[:, 0], emb[:, 1])
      plt.savefig("{}/emb_pca.png".format(dir), dpi=100)
  
imports: import matplotlib.pyplot
  import numpy
  import seaborn
  from sklearn.decomposition import PCA
  from graphgym.utils.io import makedirs
label_desc: Use image node_id 1 for calling a global function with example usage: view_emb(emb, dir) without return types