CompositionModule

class CompositionModule(*args, **kwargs)[source]

Bases: Module, ABC

An (element-wise) composition function for vectors.

Initialize internal Module state, shared by both nn.Module and ScriptModule.

Methods Summary

forward(a, b)

Compose two batches of vectors.

Methods Documentation

abstract forward(a: Tensor, b: Tensor) Tensor[source]

Compose two batches of vectors.

The tensors have to be broadcastable.

Parameters:
  • a (Tensor) – shape: s_1 The first tensor.

  • b (Tensor) – shape: s_2 The second tensor.

Returns:

shape: s

Return type:

Tensor