Module Contents


GRUCell2d(input_size, hidden_size, bias=True)
GRUModel2d(input_dim, hidden_dim, bias=True)
HiNT(weights_matrix, p)
HiNT_main(extractor, config)
HINT(config=None, provide=None, share_dependency_objects=False, build=True) Base class for profane modules.
class capreolus.reranker.HINT.GRUCell2d(input_size, hidden_size, bias=True)[source]

Bases: torch.nn.Module

softmax_by_row(self, zi, zl, zt, zd)[source]
forward(self, x, hidden_i1_j1, hidden_i1_j, hidden_i_j1)[source]
class capreolus.reranker.HINT.GRUModel2d(input_dim, hidden_dim, bias=True)[source]

Bases: torch.nn.Module

forward(self, x)[source]
class capreolus.reranker.HINT.HiNT(weights_matrix, p)[source]

Bases: torch.nn.Module

matrix_inv(self, A)[source]
forward(self, sentence, query_sentence, M_XOR, M_cos, masks)[source]

M_XOR or M_cos: (B, Q, D) masks: (B, Q, D) have 0 on non-pad positions and 1 on pad positions

class capreolus.reranker.HINT.HiNT_main(extractor, config)[source]

Bases: torch.nn.Module

forward(self, query_sentence, query_idf, pos_sentence, neg_sentence)[source]
test_forward(self, query_sentence, query_idf, pos_sentence)[source]
class capreolus.reranker.HINT.HINT(config=None, provide=None, share_dependency_objects=False, build=True)[source]

Bases: capreolus.reranker.Reranker

Base class for profane modules. Module construction proceeds as follows: 1) Any config options not present in config are filled in with their default values. Config options and their defaults are specified in the config_spec class attribute. 2) Any dependencies declared in the dependencies class attribute are recursively instantiated. If the dependency object is present in provide, this object will be used instead of instantiating a new object for the dependency. 3) The module object’s config variable is updated to reflect the configs of its dependencies and then frozen.

After construction is complete, the module’s dependencies are available as instance variables: self.`dependency key`.

  • config – dictionary containing a config to apply to this module and its dependencies
  • provide – dictionary mapping dependency keys to module objects
  • share_dependency_objects – if true, dependencies will be cached in the registry based on their configs and reused. See the share_objects argument of ModuleBase.create.
module_name = HINT[source]
description = Yixing Fan, Jiafeng Guo, Yanyan Lan, Jun Xu, Chengxiang Zhai, and Xueqi Cheng. 2018. Modeling Diverse Relevance Patterns in Ad-hoc Retrieval. In SIGIR'18.[source]
test(self, query_sentence, query_idf, pos_sentence, *args, **kwargs)[source]
score(self, d)[source]
zero_grad(self, *args, **kwargs)[source]