def intersect_dicts(checkpoint_state_dict, model_state_dict):
    """
    Dictionary intersection of matching keys and shapes using checkpoint_state_dict values
    :param checkpoint_state_dict: checkpoint state dict
    :param model_state_dict: model state dict
    :return: intersect dicts
    """

    return {key: value for key, value in checkpoint_state_dict.items() if model_state_dict[key].shape == value.shape}