delu.nn.Lambda#

class delu.nn.Lambda(fn)[source]#

A parameters-free module for wrapping callables.

Examples

assert delu.nn.Lambda(lambda: 0)() == 0
assert delu.nn.Lambda(lambda x: x)(1) == 1
assert delu.nn.Lambda(lambda x, y, z: x + y + z)(1, 2, z=3) == 6
Parameters

fn (Callable) –

__init__(fn)[source]#

Initialize self.

Parameters

fn (Callable) –

forward(*args, **kwargs)[source]#

Perform the forward pass.