code: def test_softmax_graph():
      """Make sure that sotfmax expressions are turned into
      a softmax Op.
  
      """
      rng = np.random.default_rng(utt.fetch_seed())
      x = pytensor.shared(rng.normal(size=(3, 4)))
  
      def softmax_graph(c):
          return exp(c) / exp(c).sum(axis=-1, keepdims=True)
  
      def f(inputs):
          y = softmax_graph(x)
          return pytensor.grad(None, x, known_grads={y: inputs})
  
      utt.verify_grad(f, [rng.random((3, 4))])
  
imports: import numpy
  import pytest
  import scipy.special
  import pytensor
  from pytensor import shared
  from pytensor.compile import optdb
  from pytensor.compile.mode import get_mode
  from pytensor.configdefaults import config
  from pytensor.graph.fg import FunctionGraph
  from pytensor.graph.rewriting.basic import check_stack_trace
  from pytensor.graph.rewriting.db import RewriteDatabaseQuery
  from pytensor.tensor.math import add, exp, log, true_div
  from pytensor.tensor.special import LogSoftmax, Softmax, SoftmaxGrad, softmax
  from pytensor.tensor.type import matrix
  from tests import unittest_tools
label_desc: Use image node_id 1 for calling a global function with example usage: test_softmax_graph() and returns: unknown, pytensor