private static Tensor convertToSparse(Tensor tensor) {
        if (tensor.type().dimensions().stream().noneMatch(dimension -> dimension.isIndexed())) return tensor;
        Tensor.Builder b = Tensor.Builder.of(TensorModifyUpdate.convertDimensionsToMapped(tensor.type()));
        for (Iterator<Tensor.Cell> i = tensor.cellIterator(); i.hasNext(); )
            b.cell(i.next());
        return b.build();
    }
Reader of a "modify" update of a tensor field.
document/src/main/java/com/yahoo/document/json/readers/TensorModifyUpdateReader.java