poutyne.layers

Layers

Poutyne provides utility layers that can be used with the Sequential module, ModuleList module and others.

class poutyne.layers.Flatten[source]

Flattens the input tensor such that the dimension 0 is the batch. Equivalent to x.flatten(1).

class poutyne.layers.Identity[source]

Returns the same tensor as the input. This module can be useful when removing a module from a third-party module.

class poutyne.layers.Lambda(func)[source]

Applies a function to the input tensor.

Parameters

func (Tensor -> Tensor) – The function to apply.

Example

# Alternate version to the ``Flatten`` module.
my_flatten = Lambda(lambda x: x.flatten(1))