import torch


def change_last_layer_resnet_inception(model, num_classes):
    """
    Change last layer of a resnet or inception model
    :param model: torchvision.models.module
    :param num_classes: int
    :return: torchvision.models.module
    """
    num_features_in_last_layer = model.fc.in_features
    model.fc = torch.nn.Linear(num_features_in_last_layer, num_classes)
    return model