class_docstr: This class defines the `ByteFormer <https://arxiv.org/pdf/2306.00238.pdf>`_
  architecture.
class_docstr_tok: ["This","class","defines","the","`","ByteFormer","<","https",":","\/\/arxiv.org\/pdf\/2306.00238.pdf",">","`","_","architecture","."]
docstr: Convert input bytes into embeddings to be passed to the network's
  transformer backbone.
  
  Args:
      x: The input bytes as an integer tensor of shape [batch_size,
          sequence_length]. Integer tensors are expected (rather than byte
          tensors) since -1 is usually used for padding.
  
  Returns:
      The embeddings of shape [batch_size, new_sequence_length] and a
      mask tensor of shape [batch_size, new_sequence_length]. The mask
      contains 0 at unmasked positions and float(-inf) at masked
      positions.
docstr_tok: ["Convert","input","bytes","into","embeddings","to","be","passed","to","the","network's","transformer","backbone",".","Args",":","x",":","The","input","bytes","as","an","integer","tensor","of","shape","[","batch_size",",","sequence_length","]",".","Integer","tensors","are","expected","(","rather","than","byte","tensors",")","since","-1","is","usually","used","for","padding",".","Returns",":","The","embeddings","of","shape","[","batch_size",",","new_sequence_length","]","and","a","mask","tensor","of","shape","[","batch_size",",","new_sequence_length","]",".","The","mask","contains","0","at","unmasked","positions","and","float","(","-inf",")","at","masked","positions","."]
code: def get_backbone_inputs(self, x: Tensor) -> Tuple[Tensor, Tensor]:
      """
      Convert input bytes into embeddings to be passed to the network's
      transformer backbone.
  
      Args:
          x: The input bytes as an integer tensor of shape [batch_size,
              sequence_length]. Integer tensors are expected (rather than byte
              tensors) since -1 is usually used for padding.
  
      Returns:
          The embeddings of shape [batch_size, new_sequence_length] and a
          mask tensor of shape [batch_size, new_sequence_length]. The mask
          contains 0 at unmasked positions and float(-inf) at masked
          positions.
      """
      mask = torch.zeros_like(x, dtype=torch.float)
      mask[x == -1].fill_(float("-inf"))
      mask = mask.detach().requires_grad_(False)
      x[x == -1] = self.embeddings.padding_idx
      x = self.embeddings(x)
  
      x, mask = self.apply_token_reduction_net(x, mask)
      x = x + self.pos_embed(self.max_num_tokens)[:, : x.shape[1]]
  
      x = self.emb_dropout(x)
      return x, mask
  
imports: import argparse
  import math
  from typing import Dict, Optional, Tuple, Union
  import numpy
  import torch
  from torch import Tensor, nn
  from torch.nn import init
  from cvnets.layers import LinearLayer, embedding, get_normalization_layer, normalization, positional_embedding, token_merging
  from cvnets.models import MODEL_REGISTRY, BaseAnyNNModel
  from cvnets.models.classification.config.byteformer import get_configuration
  from cvnets.modules import WindowedTransformerEncoder
label_desc: Use image node_id 5 for calling the ByteFormer obj's underlying member method code with example usage: obj.get_backbone_inputs(x) and returns: x,  mask