def _convert_softmax_nd(builder, node, graph, err):
    """
    convert to CoreML SoftMax ND Layer:
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#3547
    """
    axis = node.attrs.get('axis', 1)
    builder.add_softmax_nd(name=node.name, input_name=node.inputs[0],
        output_name=node.outputs[0] + ('_softmax' if node.op_type ==
        'LogSoftmax' else ''), axis=axis)
    if node.op_type == 'LogSoftmax':
        builder.add_unary(name=node.name + '_log', input_name=node.outputs[
            0] + '_softmax', output_name=node.outputs[0], mode='log')
