docstr: Generate the representation given the inputs.
  
  This is used for pre-training or fine-tuning a mobile bert model.
  Get the first token of the whole sequence which is [CLS]
  
  Parameters
  ----------
  sequence
      - layout = 'NT'
          Shape (batch_size, sequence_length, units)
      - layout = 'TN'
          Shape (sequence_length, batch_size, units)
  
  Returns
  -------
  ret
      Shape (batch_size, units)
docstr_tok: ["Generate","the","representation","given","the","inputs",".","This","is","used","for","pre-training","or","fine-tuning","a","mobile","bert","model",".","Get","the","first","token","of","the","whole","sequence","which","is","[","CLS","]","Parameters","--","--","--","--","--","sequence","-","layout","=","'NT'","Shape","(","batch_size",",","sequence_length",",","units",")","-","layout","=","'TN'","Shape","(","sequence_length",",","batch_size",",","units",")","Returns","--","--","--","-","ret","Shape","(","batch_size",",","units",")"]
code: def apply_pooling(self, sequence):
      """Generate the representation given the inputs.
  
      This is used for pre-training or fine-tuning a mobile bert model.
      Get the first token of the whole sequence which is [CLS]
  
      Parameters
      ----------
      sequence
          - layout = 'NT'
              Shape (batch_size, sequence_length, units)
          - layout = 'TN'
              Shape (sequence_length, batch_size, units)
  
      Returns
      -------
      ret
          Shape (batch_size, units)
      """
      if self._layout == "NT":
          outputs = sequence[:, 0, :]
      elif self._layout == "TN":
          outputs = sequence[0, :, :]
      else:
          raise NotImplementedError
      if self.classifier_activation:
          return self.pooler(outputs)
      else:
          return outputs
  
imports: import os
  from typing import Tuple
  import mxnet
  from mxnet import use_np, np, npx
  from mxnet.gluon import HybridBlock, nn
  from .base import BACKBONE_REGISTRY
  from ..op import select_vectors_by_position
  from ..base import get_model_zoo_home_dir, get_repo_model_zoo_url, get_model_zoo_checksum_dir
  from ..layers import PositionalEmbedding, get_activation
  from ..utils.misc import download, load_checksum_stats
  from ..utils.registry import Registry
  from .transformer import TransformerEncoderLayer
  from ..initializer import TruncNorm
  from ..utils.config import CfgNode
  from ..attention_cell import gen_self_attn_mask
  from ..data.tokenizers import HuggingFaceByteBPETokenizer
label_desc: Use image node_id 5 for calling the RobertaModel obj's underlying member method code with example usage: obj.apply_pooling(sequence) and returns: self, outputs