docstr: Embed all given tensors into an nfeatures-dim space.  
docstr_tok: ["Embed","all","given","tensors","into","an","nfeatures-dim","space","."]
code: def embed(self, x, nfeatures=2):
      """Embed all given tensors into an nfeatures-dim space."""
      list_split = 0
      if isinstance(x, list):
          list_split = len(x)
          x = tf.concat(x, 0)
  
      # pre-process MNIST dataflow data
      x = tf.expand_dims(x, 3)
      x = x * 2 - 1
  
      # the embedding network
      net = slim.layers.conv2d(x, 20, 5, scope="conv1")
      net = slim.layers.max_pool2d(net, 2, scope="pool1")
      net = slim.layers.conv2d(net, 50, 5, scope="conv2")
      net = slim.layers.max_pool2d(net, 2, scope="pool2")
      net = slim.layers.flatten(net, scope="flatten3")
      net = slim.layers.fully_connected(
          net, 500, scope="fully_connected4"
      )
      embeddings = slim.layers.fully_connected(
          net, nfeatures, activation_fn=None, scope="fully_connected5"
      )
  
      # if "x" was a list of tensors, then split the embeddings
      if list_split > 0:
          embeddings = tf.split(embeddings, list_split, 0)
  
      return embeddings
  
imports: import argparse
  import numpy
  import tensorflow
  import tensorflow.contrib.slim
  from tensorpack import *
  from tensorpack.tfutils.summary import add_moving_summary
  from tensorpack.utils.gpu import change_gpu
  from embedding_data import MnistPairs, MnistTriplets, get_test_data
label_desc: Use image node_id 1 for calling the EmbeddingModel obj's underlying member method code with example usage: obj.embed(x, nfeatures) and returns: embeddings