code: def get_codebook_feat(self, indices, shape):
      # input indices: batch*token_num -> (batch*token_num)*1
      # shape: batch, height, width, channel
      indices = indices.view(-1, 1)
      min_encodings = torch.zeros(
          indices.shape[0], self.codebook_size
      ).to(indices)
      min_encodings.scatter_(1, indices, 1)
      # get quantized latent vectors
      z_q = torch.matmul(min_encodings.float(), self.embedding.weight)
  
      if (
          shape is not None
      ):  # reshape back to match original input shape
          z_q = z_q.view(shape).permute(0, 3, 1, 2).contiguous()
  
      return z_q
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from basicsr.utils import get_root_logger
  from basicsr.utils.registry import ARCH_REGISTRY
label_desc: Use image node_id 3 for calling the VectorQuantizer obj's underlying member method code with example usage: obj.get_codebook_feat(indices, shape) and returns: z_q