亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用池的 Tensorflow 錯誤:無法pickle _thread.RLock 對象

使用池的 Tensorflow 錯誤:無法pickle _thread.RLock 對象

森林海 2021-09-25 16:25:19
我試圖在 Tensorflow CPU 上實現大規模并行微分方程求解器(30k DE),但內存不足(大約 30GB 矩陣)。所以我實現了一個基于批處理的求解器(在短時間內求解并保存數據 -> 設置新的初始值 -> 再次求解)。但問題仍然存在。我了解到在關閉 python 解釋器之前,Tensorflow 不會清除內存。因此,基于有關 github 問題的信息,我嘗試使用池實現多處理解決方案,但在池化步驟中我不斷收到“無法腌制 _thread.RLock 對象”。有人可以幫忙嗎!def dAdt(X,t):  dX = // vector of differential  return dXglobal state_vectorglobal statestate_vector =  [0]*n // initial statedef tensor_process():    with tf.Session() as sess:        print("Session started...",end="")        tf.global_variables_initializer().run()        state = sess.run(tensor_state)        sess.close()n_batch = 3t_batch = np.array_split(t,n_batch)for n,i in enumerate(t_batch):    print("Batch",(n+1),"Running...",end="")    if n>0:        i = np.append(i[0]-0.01,i)    print("Session started...",end="")    init_state = tf.constant(state_vector, dtype=tf.float64)    tensor_state = tf.contrib.odeint_fixed(dAdt, init_state, i)    with Pool(1) as p:        p.apply_async(tensor_process).get()    state_vector = state[-1,:]    np.save("state.batch"+str(n+1),state)    state=None
查看完整描述

3 回答

  • 3 回答
  • 0 關注
  • 385 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號