code: def dumpR(
      data_set,
      mx_model,
      batch_size,
      name="",
      data_extra=None,
      label_shape=None,
  ):
      print("dump verification embedding..")
      data_list = data_set[0]
      issame_list = data_set[1]
      model = mx_model
      embeddings_list = []
      if data_extra is not None:
          _data_extra = nd.array(data_extra)
      time_consumed = 0.0
      if label_shape is None:
          _label = nd.ones((batch_size,))
      else:
          _label = nd.ones(label_shape)
      for i in range(len(data_list)):
          data = data_list[i]
          embeddings = None
          ba = 0
          while ba < data.shape[0]:
              bb = min(ba + batch_size, data.shape[0])
              count = bb - ba
              _data = nd.slice_axis(
                  data, axis=0, begin=bb - batch_size, end=bb
              )
              # print(_data.shape, _label.shape)
              time0 = datetime.datetime.now()
              if data_extra is None:
                  db = mx.io.DataBatch(data=(_data,), label=(_label,))
              else:
                  db = mx.io.DataBatch(
                      data=(_data, _data_extra), label=(_label,)
                  )
              model.forward(db, is_train=False)
              net_out = model.get_outputs()
              _embeddings = net_out[0].asnumpy()
              time_now = datetime.datetime.now()
              diff = time_now - time0
              time_consumed += diff.total_seconds()
              if embeddings is None:
                  embeddings = np.zeros(
                      (data.shape[0], _embeddings.shape[1])
                  )
              embeddings[ba:bb, :] = _embeddings[
                  (batch_size - count) :, :
              ]
              ba = bb
          embeddings_list.append(embeddings)
      embeddings = embeddings_list[0] + embeddings_list[1]
      embeddings = sklearn.preprocessing.normalize(embeddings)
      actual_issame = np.asarray(issame_list)
      outname = os.path.join("temp.bin")
      with open(outname, "wb") as f:
          pickle.dump(
              (embeddings, issame_list),
              f,
              protocol=pickle.HIGHEST_PROTOCOL,
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import argparse
  import sys
  import numpy
  from scipy import misc
  from sklearn.model_selection import KFold
  from scipy import interpolate
  import sklearn
  import cv2
  import math
  import datetime
  import pickle
  from sklearn.decomposition import PCA
  import mxnet
  from mxnet import ndarray
label_desc: Use image node_id 9 for calling a global function with example usage: dumpR(data_set, mx_model, batch_size, name, data_extra, label_shape) without return types