ValueError: can't optimize a non

2022-09-23  本文已影响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)
上一篇下一篇

猜你喜欢

热点阅读