import torch


def haschildren(obj):
    """Check if the object has children

    Arguments:
        obj {object} -- the object to check

    Returns:
        bool -- True if the object has children
    """
    ommit_type = [torch.nn.parameter.Parameter, torch.Tensor]
    if type(obj) in ommit_type:
        return False
    else:
        return hasattr(obj, '__dict__') or hasattr(obj, 'keys')