code: def _convert_softmax_impl(op_type, func, input_names, output_names):
      axis = func.axis
      ndim = len(func.inputs[0].shape)
      if axis == ndim - 1:
          return (
              onnx_helper.make_node(
                  op_type, input_names, output_names, axis=axis
              ),
          )
  
      # Chainer's softmax computes the softmax along a single axis while
      # ONNX's computes along the specified axis and all axes after the
      # specified axis. To emulate Chainer's by ONNX's, we transpose the
      # single specified axis to the last axis, compute the softmax, and
      # transpose back to the original shape.
      gb = onnx_helper.GraphBuilder()
      perm = list(range(ndim))
      perm[axis], perm[-1] = perm[-1], perm[axis]
      transposed = gb.op("Transpose", input_names, perm=perm)
      softmaxed = gb.op(op_type, [transposed], axis=ndim - 1)
      gb.op("Transpose", [softmaxed], perm=perm)
      return gb.nodes(output_names=output_names)
  
file_path: chainer/onnx_chainer/functions/activation.py
imports: import numpy
  from onnx_chainer.functions.opset_version import support
  from onnx_chainer import onnx_helper
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_softmax_impl(op_type, func, input_names, output_names) and returns: gb, onnx_helper