Source code for catalyst.contrib.modules.common

import torch.nn as nn


[docs]class Lambda(nn.Module): def __init__(self, lambda_fn): super().__init__() self.lambda_fn = lambda_fn
[docs] def forward(self, x): return self.lambda_fn(x)
[docs]class Flatten(nn.Module): def __init__(self): super().__init__()
[docs] def forward(self, x): return x.view(x.shape[0], -1)