美文网首页
ValueError: can't optimize a non

ValueError: can't optimize a non

作者: 菌子甚毒 | 来源:发表于2022-09-23 15:12 被阅读0次
    param1 = list(model.layers.parameters())
    param2 = list(model.p)
    param = param1+param2
    """
    ValueError: can't optimize a non-leaf Tensor
    """
    

    检查:

    model.p.is_leaf # True
    list(model.p.is_leaf) # False
    

    list使is_leaf = False

    # 正确写法
    param = list(model.layers.parameters())
    param.append(model.p)
    

    相关文章

      网友评论

          本文标题:ValueError: can't optimize a non

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