Lre

class linear_relational.Lre(relation, subject_layer, object_layer, object_aggregation, weight, bias, metadata=None)[source]

Linear Relational Embedding

bias
calculate_object_activation(subject_activations, normalize=False)[source]
forward(subject_activations, normalize=False)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

invert(rank)[source]

Invert this LRE using a low-rank approximation

metadata = None
object_aggregation
object_layer
relation
subject_layer
to_low_rank(rank)[source]

Create a low-rank approximation of this LRE

weight
class linear_relational.LowRankLre(relation, subject_layer, object_layer, object_aggregation, u, s, v, bias, metadata=None)[source]

Low-rank approximation of a LRE

bias
calculate_object_activation(subject_activations, normalize=False)[source]
forward(subject_activations, normalize=False)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

metadata = None
object_aggregation
object_layer
property rank
relation
s
subject_layer
u
v
w_times_vec(vec)[source]
class linear_relational.InvertedLre(relation, subject_layer, object_layer, object_aggregation, u, s, v, bias, metadata=None)[source]

Low-rank inverted LRE, used for calculating subject activations from object activations

bias
calculate_subject_activation(object_activations, normalize=False)[source]
forward(object_activations, normalize=False)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

metadata = None
object_aggregation
object_layer
property rank
relation
s
subject_layer
u
v
w_inv_times_vec(vec)[source]