pytorch中model.modules()和model.children()的區別

  model.modules()和model.children()均爲迭代器,model.modules()會遍歷model中全部的子層,而model.children()僅會遍歷當前層。python 使用:code for key in model.modules(): print(key) # model.modules()相似於 [[1, 2], 3],其遍歷結果爲: [[1, 2
相關文章
相關標籤/搜索