-1
在theano下面的代碼片斷是拋出存儲器錯誤:內存錯誤:Numpy.random.normal
self.w = theano.shared(
np.asarray(
np.random.normal(
loc=0.0, scale=np.sqrt(1.0/n_out), size=(n_in, n_out)),
dtype=theano.config.floatX),
name='w', borrow=True)
僅舉大小N_IN = 64 * 56 * 56和N_OUT = 4096。摘錄摘自完全連接層的方法init。看到回溯:
Traceback (most recent call last):
File "<stdin>", line 8, in <module>
File "final.py", line 510, in __init__
loc=0.0, scale=np.sqrt(1.0/n_out), size=(n_in, n_out)),
File "mtrand.pyx", line 1636, in mtrand.RandomState.normal (numpy/random/mtrand/mtrand.c:20676)
File "mtrand.pyx", line 242, in mtrand.cont2_array_sc (numpy/random/mtrand/mtrand.c:7401)
MemoryError
有什麼辦法可以解決這個問題嗎?
這是一個巨大的數組(8.22億元素!)。這實際上不太可能需要分配。 – y300
解決方法很簡單:@MSeifert數組被用來保存深層神經網絡的參數用更少的元素試試吧:) – MSeifert
,我們必須初始化所有參數,隨機獲得下手的問題。爲了減少你建議的參數數量,我們將不得不改變我不想要的網絡架構。 –