code: def encode(self, sentences, bsize=64, tokenize=True, verbose=False):
      tic = time.time()
      sentences, lengths, idx_sort = self.prepare_samples(
          sentences, bsize, tokenize, verbose
      )
  
      embeddings = []
      for stidx in range(0, len(sentences), bsize):
          batch = self.get_batch(sentences[stidx : stidx + bsize])
          if self.is_cuda():
              batch = batch.to(textattack.shared.utils.device)
          with torch.no_grad():
              batch = (
                  self.forward((batch, lengths[stidx : stidx + bsize]))
                  .data.cpu()
                  .numpy()
              )
          embeddings.append(batch)
      embeddings = np.vstack(embeddings)
  
      # unsort
      idx_unsort = np.argsort(idx_sort)
      embeddings = embeddings[idx_unsort]
  
      if verbose:
          print(
              "Speed : %.1f sentences/s (%s mode, bsize=%s)"
              % (
                  len(embeddings) / (time.time() - tic),
                  "gpu" if self.is_cuda() else "cpu",
                  bsize,
              )
          )
      return embeddings
  
imports: import time
  import numpy
  import torch
  from torch import nn
  import textattack
label_desc: Use image node_id 14 for calling the InferSentModel obj's underlying member method code with example usage: obj.encode(sentences, bsize, tokenize, verbose) and returns: embeddings