code: def save_val_embeddings(
      sess, model, minibatch_iter, size, out_dir, mod=""
  ):
      val_embeddings = []
      finished = False
      seen = set([])
      nodes = []
      iter_num = 0
      name = "val"
      while not finished:
          (
              feed_dict_val,
              finished,
              edges,
          ) = minibatch_iter.incremental_embed_feed_dict(size, iter_num)
          iter_num += 1
          outs_val = sess.run(
              [model.loss, model.mrr, model.outputs1],
              feed_dict=feed_dict_val,
          )
          # ONLY SAVE FOR embeds1 because of planetoid
          for i, edge in enumerate(edges):
              if not edge[0] in seen:
                  val_embeddings.append(outs_val[-1][i, :])
                  nodes.append(edge[0])
                  seen.add(edge[0])
      if not os.path.exists(out_dir):
          os.makedirs(out_dir)
      val_embeddings = np.vstack(val_embeddings)
      np.save(out_dir + name + mod + ".npy", val_embeddings)
      with open(out_dir + name + mod + ".txt", "w") as fp:
          fp.write("\n".join(map(str, nodes)))
  
file_path: GraphSAGE/graphsage/unsupervised_train.py
imports: from __future__ import division
  from __future__ import print_function
  import os
  import time
  import tensorflow
  import numpy
  from graphsage.models import SampleAndAggregate, SAGEInfo, Node2VecModel
  from graphsage.minibatch import EdgeMinibatchIterator
  from graphsage.neigh_samplers import UniformNeighborSampler
  from graphsage.utils import load_data
label_desc: Use image node_id 4 for calling a global function with example usage: save_val_embeddings(sess, model, minibatch_iter, size, out_dir, mod) without return types