看板 Python 關於我們 聯絡資訊
想請教一個簡單的model問題如下 def generator(): input = Input(shape=(100,)) y = Dense(300,activation = "relu")(input) y = Dense(500,activation = "relu")(y) y = Dense(784,activation = "relu")(y) return Model(input,y) 以上就只是個簡單的model 問題來了: Case I:(成功) ori_model = generator() y = ori_model.output model = Model(ori_model.input, y) Case II:(失敗) generator() y = generator().output model = Model(generator().input, y) =================================== 我想知道Case II失敗的詳細原因 目前我只能說出個籠統的說法是,沒有先令一個變數的話(像caseI令成ori_model) code並不知道要去找同一個model,而會去重複call generator()導致tf.graph接不上 但是這說法也只是我有了case I,II的比較才得出的 想求教詳細的原因,感謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 219.68.160.241 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1528480574.A.CF8.html
bibo9901: 原因就是你說的 06/09 04:28
bibo9901: 真有趣, 大部份初學者的問題都是恰好相反 -- 重覆call 06/09 04:28
bibo9901: 同一個函數而不做暫存, 你的問題剛好反過來.. 06/09 04:29
tsoahans: 你創了兩個model A B,你拿A的頭去接B的尾巴 06/09 18:11
D0128431: 可以去資料科學版問 06/10 19:29
znmkhxrw: 好 謝謝! 06/11 00:47
wtleader01: 真不愧是史上最強初學者 06/11 11:04
znmkhxrw: 去屎! 06/11 11:39