class_docstr: Gradient wrt x of the Softmax Op.
class_docstr_tok: ["Gradient","wrt","x","of","the","Softmax","Op","."]
code: def grad(self, inp, grads):
      dy, sm = inp
      (g,) = grads
  
      tmp = g + neg(sum(g * sm, axis=self.axis, keepdims=True))
      g_dy = tmp * sm
  
      tmp2 = sum(dy * sm, axis=self.axis, keepdims=True)
      g_sm = tmp * dy - g * tmp2
  
      return g_dy, g_sm
  
imports: from textwrap import dedent
  import numpy
  import scipy
  from pytensor.graph.basic import Apply
  from pytensor.graph.replace import _vectorize_node
  from pytensor.link.c.op import COp
  from pytensor.tensor.basic import as_tensor_variable
  from pytensor.tensor.elemwise import get_normalized_batch_axes
  from pytensor.tensor.math import gamma, gammaln, neg, sum
label_desc: Use image node_id 4 for calling the SoftmaxGrad obj's underlying member method code with example usage: obj.grad(inp, grads) and returns: g_dy,  g_sm