docstr: :param x_in: input data tensor
  :param apply_softmax: flag for the softmax activation
          should be false if used with the Cross Entropy losses
  :return: the resulting tensor. tensor.shape should be (batch, num_classes)
docstr_tok: [":","param","x_in",":","input","data","tensor",":","param","apply_softmax",":","flag","for","the","softmax","activation","should","be","false","if","used","with","the","Cross","Entropy","losses",":","return",":","the","resulting","tensor",".","tensor.shape","should","be","(","batch",",","num_classes",")"]
code: def forward(
      self, x_in: torch.Tensor, apply_softmax: bool = False
  ) -> torch.Tensor:
      """
  
      :param x_in: input data tensor
      :param apply_softmax: flag for the softmax activation
              should be false if used with the Cross Entropy losses
      :return: the resulting tensor. tensor.shape should be (batch, num_classes)
      """
  
      # embed and permute so features are channels
      x_embedded = self.emb(x_in).permute(0, 2, 1)
  
      features = self.convnet(x_embedded)
  
      # average and remove the extra dimension
      remaining_size = features.size(dim=2)
      features = torch.nn.functional.avg_pool1d(
          features, remaining_size
      ).squeeze(dim=2)
      features = self.dropout(features)
  
      # mlp classifier
      intermediate_vector = torch.nn.functional.relu(
          self.dropout(self.fc1(features))
      )
      prediction_vector = self.fc2(intermediate_vector)
  
      if apply_softmax:
          prediction_vector = torch.nn.functional.softmax(
              prediction_vector, dim=1
          )
  
      return prediction_vector
  
imports: import logging
  import string
  from collections import Counter
  from typing import Dict, List, Any
  import numpy
  import pandas
  import torch
  from transfer_nlp.common.tokenizers import CustomTokenizer
  from transfer_nlp.embeddings.embeddings import Embedding
  from transfer_nlp.loaders.loaders import DatasetSplits, DataFrameDataset
  from transfer_nlp.loaders.vectorizers import Vectorizer
  from transfer_nlp.loaders.vocabulary import Vocabulary, SequenceVocabulary
  from transfer_nlp.plugins.config import register_plugin
  from transfer_nlp.plugins.predictors import PredictorABC
label_desc: Use image node_id 2 for calling the NewsClassifier obj's underlying member method code with example usage: obj.forward(x_in, apply_softmax) and returns: prediction_vector