ConcatProjectionCombination

class ConcatProjectionCombination(input_dims, output_dim=None, bias=True, dropout=0.0, activation=<class 'torch.nn.modules.linear.Identity'>, activation_kwargs=None)[source]

Bases: ConcatCombination

Combine representations by concatenation follow by a linear projection and activation.

Initialize the combination.

Parameters
  • input_dims (Sequence[int]) – the input dimensions

  • output_dim (Optional[int]) – the output dimension. Defaults to the first input dimension

  • bias (bool) – whether to add a bias term in between the linear projection and the activation

  • dropout (float) – dropout to use before the activation

  • activation (Union[str, Module, Type[Module], None]) – the activation, or a hint thereof

  • activation_kwargs (Optional[Mapping[str, Any]]) – additional keyword-based parameters used to instantiate the activation

Raises

ValueError – if input_dims is empty

Methods Summary

forward(xs)

Combine a sequence of individual representations.

Methods Documentation

forward(xs)[source]

Combine a sequence of individual representations.

Parameters

xs (Sequence[FloatTensor]) – shape: (*batch_dims, *input_dims_i) the individual representations

Return type

FloatTensor

Returns

shape: (*batch_dims, *output_dims) a combined representation