private Tensor sparsifyReduce(Tensor modelOutput, TensorType tensorType) {
        // Remove batch dim, batch size of 1
        Tensor output = modelOutput.reduce(Reduce.Aggregator.max, "d0", "d1");
        Tensor logOfRelu = output.map((x) -> Math.log(1 + (x > 0 ? x : 0)));
        IndexedTensor vocab = (IndexedTensor) logOfRelu;
        var builder = Tensor.Builder.of(tensorType);
        long[] tokens = new long[1];
        for (int i = 0; i < vocab.size(); i++) {
            var score = vocab.get(i);
            if (score > termScoreThreshold) {
                tokens[0] = i;
                String term = tokenizer.decode(tokens);
                builder.cell().
                        label(tensorType.dimensions().get(0).name(), term)
                        .value(score);
            }
        }
        return builder.build();
    }
Sparsify the output tensor by applying a threshold on the log of the relu of the output.
This uses generic tensor reduce+map, and is slightly slower than a custom unrolled variant.

@param modelOutput the model output tensor of shape d1,dim where d1 is the sequence length and dim is size
                   of the vocabulary
@param tensorType the type of the destination tensor
@return A mapped tensor with the terms from the vocab that has a score above the threshold
model-integration/src/main/java/ai/vespa/embedding/SpladeEmbedder.java