code: def encode(self, net: Tensor) -> Tensor:
      net = self.generator.encode({INPUT_KEY: net})
      net = self.to_embedding(net)
      return net
  
imports: import torch
  import torch.nn
  from torch import Tensor
  from typing import Tuple
  from typing import Optional
  from cftool.types import tensor_dict_type
  from .common import IAutoEncoder
  from .common import AutoEncoderInit
  from .common import AutoEncoderLPIPSWithDiscriminator
  from ..general import VQCodebook
  from ...schemas import CustomTrainStepLoss
  from ....schema import IDLModel
  from ....constants import INPUT_KEY
  from ....constants import PREDICTIONS_KEY
  from ....losses.vae import VQVAELoss
label_desc: Use image node_id 2 for calling the AutoEncoderVQ obj's underlying member method code with example usage: obj.encode(net) and returns: net