Combination

class Combination[source]

Bases: Module, ExtraReprMixin, ABC

Base class for combinations.

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

Methods Summary

forward(xs)

Combine a sequence of individual representations.

output_shape(input_shapes)

Calculate the output shape for the given input shapes.

Methods Documentation

abstract 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

output_shape(input_shapes)[source]

Calculate the output shape for the given input shapes.

Note

this method runs a single forward pass if no symbolic computation is available.

Parameters

input_shapes (Sequence[Tuple[int, …]]) – the input shapes without the batch dimensions

Return type

Tuple[int, …]

Returns

the output shape