class_docstr: Quantized version of `torch.nn.Softmax`. Adds quantization-specific arguments on top of `torch.nn.Softmax`.
  
  Args:
      output_bit (`int`):
          Bitwidth for the layer output activation.
      quant_mode (`bool`, *optional*, defaults to `False`):
          Whether or not the layer is quantized.
      force_dequant (`str`, *optional*, defaults to `"none"`):
          Force dequantize the layer if either "softmax" or "nonlinear" is given.
class_docstr_tok: ["Quantized","version","of","`","torch.nn.Softmax","`",".","Adds","quantization-specific","arguments","on","top","of","`","torch.nn.Softmax","`",".","Args",":","output_bit","(","`","int","`",")",":","Bitwidth","for","the","layer","output","activation",".","quant_mode","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","or","not","the","layer","is","quantized",".","force_dequant","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","none","''","`",")",":","Force","dequantize","the","layer","if","either","``","softmax","''","or","``","nonlinear","''","is","given","."]
code: def forward(self, x, scaling_factor):
      if not self.quant_mode:
          return nn.functional.softmax(x, dim=-1), None
  
      x_int = x / scaling_factor
  
      x_int_max, _ = x_int.max(dim=-1, keepdim=True)
      x_int = x_int - x_int_max
      exp_int, exp_scaling_factor = self.int_exp(x_int, scaling_factor)
  
      # Avoid overflow
      exp, exp_scaling_factor = self.act(exp_int, exp_scaling_factor)
      exp_int = exp / exp_scaling_factor
  
      exp_int_sum = exp_int.sum(dim=-1, keepdim=True)
      factor = floor_ste.apply(2**self.max_bit / exp_int_sum)
      exp_int = floor_ste.apply(
          exp_int * factor / 2 ** (self.max_bit - self.output_bit)
      )
      scaling_factor = 1 / 2**self.output_bit
      return exp_int * scaling_factor, scaling_factor
  
imports: import decimal
  import numpy
  import torch
  from torch import nn
  from torch.autograd import Function
  from ...utils import logging
label_desc: Use image node_id 4 for calling the IntSoftmax obj's underlying member method code with example usage: obj.forward(x, scaling_factor) and returns: unknown,  scaling_factor, nn,  None