1
我正在为分类任务构建一个简单的FeedForward网络。 我在AWS g2.2xlarge实例的theano上使用keras。我的网络配置如下:在AWS GPU上使用Theano的内存错误
batch_size = 32
nb_epoch = 50
dimof_input = 8100
dimof_middle = 16384
dimof_end = 16384
dropout = 0.2
dimof_output = 3
print('Build model...')
model = Sequential()
model.add(Dense(dimof_middle, input_shape=(dimof_input,)))
model.add(Activation('relu'))
model.add(Dropout(0.2))
model.add(Dense(dimof_end))
model.add(Activation('relu'))
model.add(Dropout(0.2))
#model.add(Dense(dimof_output))
#model.add(Activation('sigmoid'))
#model.add(Dense(dimof_output, activation='softmax'))
model.add(Dense(dimof_output))
model.add(Activation('softmax'))
model.compile(loss='categorical_crossentropy', optimizer='adam')
当我编译模型,我得到的MemoryError
MemoryError: ('Error allocating 1073741824 bytes of device memory (CNMEM_STATUS_OUT_OF_MEMORY).', "you might consider using 'theano.shared(..., borrow=True)'")
从AWS这是一个4GB显存,16 GB内存的机器。 如果我将'dimof_middle'的值减半到8196。一切运行良好。
1073741824字节〜1 GB是内GPU内存以及
什么错我在干嘛?任何帮助将非常感激!