function logSoftmax_(logits, axis = -1) {
    const $logits = (0, _tensorUtilEnv.convertToTensor)(logits, "logits", "logSoftmax");
    if (axis === -1) axis = $logits.rank - 1;
    if (axis !== $logits.rank - 1) throw Error("Log Softmax along a non-last dimension is not yet supported. " + `Logits was rank ${$logits.rank} and axis was ${axis}`);
    // const forward: ForwardFunc<Tensor> = (backend, save) => {
    //   const keepDims = true;
    //   const xMax = max(logits, axis, true);
    //   const shifted = sub(logits, xMax);
    //   const value =
    //       sub(cast(shifted, 'float32'), log(sum(exp(shifted), axis,
    //       keepDims)));
    //   save([value]);
    //   return value;
    // };
    // Use a custom gradient for numerical stability.
    const customOp = (0, _gradients.customGrad)((logits, save)=>{
        const keepDims = true;
        const xMax = (0, _max.max)(logits, axis, true);
        const shifted = (0, _sub.sub)(logits, xMax);
        const value = (0, _sub.sub)((0, _cast.cast)(shifted, "float32"), (0, _log.log)((0, _sum.sum)((0, _exp.exp)(shifted), axis, keepDims)));
        save([
            value
        ]);
        const gradFunc = (dy, saved)=>{
            const [value] = saved;
            const keepDims = true;
            const softmax = (0, _exp.exp)(value);
            return (0, _sub.sub)(dy, (0, _mul.mul)((0, _sum.sum)(dy, axis, keepDims), softmax));
        };
        return {
            value,
            gradFunc
        };
    });
    return customOp($logits);
// TODO Use Engine.runKernel when CPU/WebGL/WASM backends implement this.
// const inputs: LogSoftmaxInputs = {logits: $logits};
// const attrs: LogSoftmaxAttrs = {axis};
// return ENGINE.runKernel(
//            LogSoftmax, inputs as unknown as NamedTensorMap,
//            attrs as unknown as NamedAttrMap);
}
Computes the log softmax.

```js
const a = tf.tensor1d([1, 2, 3]);

a.logSoftmax().print();  // or tf.logSoftmax(a)
```

```js
const a = tf.tensor2d([2, 4, 6, 1, 2, 3], [2, 3]);

a.logSoftmax().print();  // or tf.logSoftmax(a)
```

@param logits The logits array.
@param axis The dimension softmax would be performed on. Defaults to `-1`
    which indicates the last dimension.

@doc {heading: 'Operations', subheading: 'Normalization'}