private void encodeCells(GrowableByteBuffer buffer, MixedTensor tensor, Consumer<Double> consumer) {
        List<TensorType.Dimension> sparseDimensions = tensor.type().dimensions().stream().filter(d -> !d.isIndexed()).toList();
        long denseSubspaceSize = tensor.denseSubspaceSize();
        var denseSubspaces = tensor.getInternalDenseSubspaces();
        if (sparseDimensions.size() > 0) {
            buffer.putInt1_4Bytes(denseSubspaces.size());
        }
        for (var subspace : denseSubspaces) {
            for (int index = 0; index < subspace.sparseAddress.size(); index++) {
                buffer.putUtf8String(subspace.sparseAddress.label(index));
            }
            for (double val : subspace.cells) {
                consumer.accept(val);
            }
        }
    }
Implementation of a mixed binary format for a tensor.
See eval/src/vespa/eval/tensor/serialization/format.txt for format.

@author lesters
vespajlib/src/main/java/com/yahoo/tensor/serialization/MixedBinaryFormat.java