capreolus.reranker.TFKNRM

Module Contents

Classes

TFKNRM_Class(extractor, config, **kwargs)
TFKNRM()
class capreolus.reranker.TFKNRM.TFKNRM_Class(extractor, config, **kwargs)[source]

Bases: tensorflow.keras.Model

get_score(self, doc_tok, query_tok, query_idf)[source]
call(self, x, **kwargs)[source]

During training, both posdoc and negdoc are passed During eval, both posdoc and negdoc are passed but negdoc would be a zero tensor Whether negdoc is a legit doc tensor or a dummy zero tensor is determined by which sampler is used (eg: sampler.TrainDataset) as well as the extractor (eg: EmbedText)

Unlike the pytorch KNRM model, KNRMTF accepts both the positive and negative document in its forward pass. It scores them separately and returns the score difference (i.e posdoc_score - negdoc_score).

class capreolus.reranker.TFKNRM.TFKNRM[source]

Bases: capreolus.reranker.Reranker

module_name = TFKNRM[source]
dependencies[source]
config_spec[source]
build_model(self)[source]