docstr: Imshow for Tensor.
docstr_tok: ["Imshow","for","Tensor","."]
code: def _imshow(self, image, caption, i, fig, N):
      """Imshow for Tensor."""
      ax = fig.add_subplot(N // 2, 4, i * 2 + 1)
      ax.axis("off")
      image = image.numpy().transpose((1, 2, 0))  #
      plt.imshow(image)
      ax = fig.add_subplot(N // 2, 4, i * 2 + 2)
      pos = ax.get_position()
      ax.axis("off")
      plt.text(
          x=0.5 * (pos.x0 + pos.x1),
          y=0.5 * (pos.y0 + pos.y1),
          ha="left",
          s="{}".format(
              " ".join(
                  self.i2w[str(i)] + "\n"
                  if (n + 1) % 5 == 0
                  else self.i2w[str(i)]
                  for n, i in enumerate(caption)
              )
          ),
          fontsize=6,
          verticalalignment="center",
          horizontalalignment="center",
      )
      return fig
  
imports: import matplotlib.pyplot
  import torch.distributions
  import torch.nn
  import torch.nn.functional
  import torch.utils.data
  from numpy import sqrt, prod
  from torch.utils.data import DataLoader
  from torchnet.dataset import TensorDataset, ResampleDataset
  from torchvision.utils import save_image, make_grid
  from utils import Constants
  from vis import plot_embeddings, plot_kls_df
  from .mmvae import MMVAE
  from .vae_cub_image import CUB_Image
  from .vae_cub_sent import CUB_Sentence
label_desc: Use image node_id 8 for calling the CUB_Image_Sentence obj's underlying member method code with example usage: obj._imshow(image, caption, i, fig, N) and returns: fig