class_docstr: Implementation of the NNCLR[0] architecture
  
  Recommended loss: :py:class:`lightly.loss.ntx_ent_loss.NTXentLoss`
  Recommended module: :py:class:`lightly.models.modules.nn_memory_bank.NNmemoryBankModule`
  
  [0] NNCLR, 2021, https://arxiv.org/abs/2104.14548
  
  Attributes:
      backbone:
          Backbone model to extract features from images.
      num_ftrs:
          Dimension of the embedding (before the projection head).
      proj_hidden_dim:
          Dimension of the hidden layer of the projection head.
      pred_hidden_dim:
          Dimension of the hidden layer of the predicion head.
      out_dim:
          Dimension of the output (after the projection head).
      num_mlp_layers:
          Number of linear layers for MLP.
  
  Examples:
      >>> model = NNCLR(backbone)
      >>> criterion = NTXentLoss(temperature=0.1)
      >>>
      >>> nn_replacer = NNmemoryBankModule(size=2 ** 16)
      >>>
      >>> # forward pass
      >>> (z0, p0), (z1, p1) = model(x0, x1)
      >>> z0 = nn_replacer(z0.detach(), update=False)
      >>> z1 = nn_replacer(z1.detach(), update=True)
      >>>
      >>> loss = 0.5 * (criterion(z0, p1) + criterion(z1, p0))
code: def __init__(
      self,
      backbone: nn.Module,
      num_ftrs: int = 512,
      proj_hidden_dim: int = 2048,
      pred_hidden_dim: int = 4096,
      out_dim: int = 256,
  ):
      super(NNCLR, self).__init__()
  
      self.backbone = backbone
      self.num_ftrs = num_ftrs
      self.proj_hidden_dim = proj_hidden_dim
      self.pred_hidden_dim = pred_hidden_dim
      self.out_dim = out_dim
  
      self.projection_mlp = NNCLRProjectionHead(
          num_ftrs,
          proj_hidden_dim,
          out_dim,
      )
  
      self.prediction_mlp = NNCLRPredictionHead(
          out_dim,
          pred_hidden_dim,
          out_dim,
      )
  
      warnings.warn(
          Warning(
              "The high-level building block NNCLR will be deprecated in version 1.3.0. "
              + "Use low-level building blocks instead. "
              + "See https://docs.lightly.ai/self-supervised-learning/lightly.models.html for more information"
          ),
          DeprecationWarning,
      )
  
file_path: lightly/lightly/models/nnclr.py
imports: import warnings
  import torch
  import torch.nn
  from lightly.models.modules import NNCLRPredictionHead, NNCLRProjectionHead
label_desc: Use image node_id 1 to create a new NNCLR object from inherited base classes: nn with example: obj = NNCLR(backbone, num_ftrs, proj_hidden_dim, pred_hidden_dim, out_dim)