import torch


def get_last_conv(m):
    """
    Get the last conv layer in an Module.
    """
    convs = filter(lambda k: isinstance(k, torch.nn.Conv2d), m.modules())
    # print('convs:', convs)
    # print('list(convs)[-1]:', list(convs)[-1])
    return list(convs)[-1]