美文网首页
reproducibility()

reproducibility()

作者: 菌子甚毒 | 来源:发表于2022-05-11 16:29 被阅读0次

以供复制。

def reproducibility(chosen_seed):
    """
    The is required for reproducible experimentation. It sets the random
    generators for the different libraries used to a specific, user chosen
    seed.

    Input
        chosen_seed: int - The seed chosen for this experiment
    """
    torch.manual_seed(chosen_seed)
    torch.cuda.manual_seed_all(chosen_seed)
    torch.backends.cudnn.deterministic = True
    torch.backends.cudnn.benchmark = False
    np.random.seed(chosen_seed)
    random.seed(chosen_seed)

相关文章

网友评论

      本文标题:reproducibility()

      本文链接:https://www.haomeiwen.com/subject/rfadurtx.html