def renderLatex(
                inputData,
                targetData,
                questionIdict,
                ansIdict,
                urlDict,
                outputFolder,
                pictureFolder='img',
                topK=10,
                comments=None,
                caption=None,
                modelOutputs=None,
                modelNames=None,
                questionIds=None,
                filename='result.tex'):
    imgPerRow = 3
    rowsPerPage = 3
    imgPerPage = imgPerRow * rowsPerPage
    imgFolder = os.path.join(outputFolder, 'img')
    if imgPerPage < inputData.shape[0]:
        latexStr = renderLatexSinglePage(
                        inputData,
                        targetData,
                        questionIdict,
                        ansIdict,
                        urlDict,
                        outputFolder,
                        pictureFolder=pictureFolder,
                        topK=topK,
                        comments=comments,
                        caption=caption,
                        modelOutputs=modelOutputs,
                        modelNames=modelNames,
                        questionIds=questionIds)
    else:
        result = []
        numPages = int(np.ceil(inputData.shape[0] / float(imgPerPage)))
        for i in range(numPages):
            start = imgPerPage * i
            end = min(inputData.shape[0], imgPerPage * (i + 1))
            if modelOutputs is not None:
                modelOutputSlice = []
                for j in range(len(modelNames)):
                    modelOutputSlice.append(modelOutputs[j][start:end])
            else:
                modelOutputSlice = None
            page = renderLatexSinglePage(
                        inputData[start:end],
                        targetData[start:end],
                        questionIdict,
                        ansIdict,
                        urlDict,
                        outputFolder,
                        pictureFolder=pictureFolder,
                        topK=topK,
                        comments=comments[start:end] \
                        if comments is not None else None,
                        caption=caption,
                        modelOutputs=modelOutputSlice,
                        modelNames=modelNames, 
                        questionIds=questionIds[start:end])
            result.append(page)
        latexStr = ''.join(result)
    with open(os.path.join(outputFolder, filename), 'w') as f:
        f.write(latexStr)
dataset/ETHPy150Open renmengye/imageqa-public/src/imageqa_render.py/renderLatex/swapped operands of `<`