code: def test_last_dim_softmax_does_softmax_on_last_dim(self):
      batch_size = 1
      length_1 = 5
      length_2 = 3
      num_options = 4
      options_array = numpy.zeros(
          (batch_size, length_1, length_2, num_options)
      )
      for i in range(length_1):
          for j in range(length_2):
              options_array[0, i, j] = [2, 4, 0, 1]
      options_tensor = torch.from_numpy(options_array)
      softmax_tensor = util.last_dim_softmax(
          options_tensor
      ).data.numpy()
      assert softmax_tensor.shape == (
          batch_size,
          length_1,
          length_2,
          num_options,
      )
      for i in range(length_1):
          for j in range(length_2):
              assert_almost_equal(
                  softmax_tensor[0, i, j],
                  [0.112457, 0.830953, 0.015219, 0.041371],
                  decimal=5,
              )
  
imports: from __future__ import with_statement
  from __future__ import division
  from __future__ import absolute_import
  import numpy
  from numpy.testing import assert_array_almost_equal, assert_almost_equal
  import torch
  import pytest
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.nn import util
label_desc: Use image node_id 15 for calling the TestNnUtil obj's underlying member method code with example usage: obj.test_last_dim_softmax_does_softmax_on_last_dim() without return types