class_docstr: TextClassifier handler class. This handler takes a text (string) and
  as input and returns the classification text based on the model vocabulary.
class_docstr_tok: ["TextClassifier","handler","class",".","This","handler","takes","a","text","(","string",")","and","as","input","and","returns","the","classification","text","based","on","the","model","vocabulary","."]
docstr: The Inference Request is made through this function and the user
  needs to override the inference function to customize it.
  
  Args:
      data (torch tensor): The data is in the form of Torch Tensor
                           whose shape should match that of the
                            Model Input shape.
  
  Returns:
      (Torch Tensor): The predicted response from the model is returned
                      in this function.
docstr_tok: ["The","Inference","Request","is","made","through","this","function","and","the","user","needs","to","override","the","inference","function","to","customize","it",".","Args",":","data","(","torch","tensor",")",":","The","data","is","in","the","form","of","Torch","Tensor","whose","shape","should","match","that","of","the","Model","Input","shape",".","Returns",":","(","Torch","Tensor",")",":","The","predicted","response","from","the","model","is","returned","in","this","function","."]
code: def inference(self, data, *args, **kwargs):
      """The Inference Request is made through this function and the user
      needs to override the inference function to customize it.
  
      Args:
          data (torch tensor): The data is in the form of Torch Tensor
                               whose shape should match that of the
                                Model Input shape.
  
      Returns:
          (Torch Tensor): The predicted response from the model is returned
                          in this function.
      """
      text_tensor, _ = data
      offsets = torch.as_tensor([0], device=self.device)
      return super().inference(text_tensor, offsets)
  
file_path: serve/ts/torch_handler/text_classifier.py
imports: import logging
  import torch
  import torch.nn.functional
  from captum.attr import TokenReferenceBase
  from torchtext.data.utils import ngrams_iterator
  from ..utils.util import map_class_to_label
  from .text_handler import TextHandler
label_desc: Use image node_id 2 for calling the TextClassifier obj's underlying member method code with example usage: obj.inference(data) and returns: super