python陣列記憶體錯誤 Numpy陣列錯誤記憶體

2021-10-18 15:29:20 字數 2221 閱讀 1611

執行乙個模型並在numpy陣列中返回結果,我得到記憶體錯誤。在

版本ubuntu 14.04.3 lts

ec2 g2.2x大影象:ami-125b2c7215gb記憶體,8vcpu

python:python 2.7.6

在numpy.version.version版本:1.13.3

*在16gb記憶體的macos中執行良好。在

錯誤using tensorflow backend.

dataset: 6000 train images.

descriptions: train=6000

vocabulary size: 7579

photos: train=6000

description length: 34

traceback (most recent call last):

file "main.py", line 291, in

x1train, x2train, ytrain = create_sequences(tokenizer, max_length, train_descriptions, train_features)

file "main.py", line 225, in create_sequences

return array(x1), array(x2), array(y)

memoryerror

記憶體資訊memtotal: 15400948 kb

memfree: 14558676 kb

buffers: 388 kb

cached: 604332 kb

swapcached: 3764 kb

active: 301464 kb

inactive: 315596 kb

active(anon): 1344 kb

inactive(anon): 11296 kb

active(file): 300120 kb

inactive(file): 304300 kb

unevictable: 0 kb

mlocked: 0 kb

swaptotal: 1048572 kb

swapfree: 1029036 kb

dirty: 0 kb

writeback: 0 kb

anonpages: 8672 kb

shmem: 228 kb

slab: 110036 kb

sreclaimable: 90396 kb

sunreclaim: 19640 kb

kernelstack: 1416 kb

pagetables: 3128 kb

nfs_unstable: 0 kb

bounce: 0 kb

writebacktmp: 0 kb

commitlimit: 8749044 kb

committed_as: 164204 kb

vmalloctotal: 34359738367 kb

vmallocused: 36252 kb

vmallocchunk: 34359696924 kb

hardwarecorrupted: 0 kb

anonhugepages: 0 kb

hugepages_total: 0

hugepages_free: 0

hugepages_rsvd: 0

hugepages_surp: 0

hugepagesize: 2048 kb

directmap4k: 71680 kb

directmap2m: 15656960 kb

icreated乙個14gb的交換檔案,30秒後結果相同。在root@ip-172-31-29-206:~# free -h

total used free shared buffers cached

mem: 14g 14g 276m 0b 292k 3.7m

-/+ buffers/cache: 14g 280m

swap: 14g 4.5g 10g

root@ip-172-31-29-206:~# free -h

total used free shared buffers cached

mem: 14g 10g 4.5g 0b 292k 6.8m

-/+ buffers/cache: 10g 4.5g

swap: 14g 4.3g 10g

一維陣列指標 num和 num的區別

一維陣列指標 num和 num的區別 include includevoid main int p num int pa 10 num printf x n x num,num printf d n d sizeof num sizeof num printf n d n d sizeof p si...

python記憶體管理錯誤的 Python記憶體管理

python採用block pool arenas三種結構來管理記憶體申請。入口 申請nbytes的記憶體 undef pyobject malloc void pyobject malloc size t nbytes block bp poolp pool poolp next uint siz...

結構體內的陣列 申請記憶體錯誤

1 請看下面的一段 typedef struct pvs set time user time grouppvs set time user time group 這裡的結構體內部用定義了乙個指標,但是使用下面的 會出現提示不相容 m timegroup timeprd pvs timeprd ma...