memoryerror: Unable to allocate array with shape (60000, 28, 28) and data ty
生活随笔
收集整理的這篇文章主要介紹了
memoryerror: Unable to allocate array with shape (60000, 28, 28) and data ty
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
使用tf縮放圖片遇到
(train_images, train_labels), (test_images,test_labels) = keras.datasets.fashion_mnist.load_data() train_images = train_images / 255.0memoryerror: Unable to allocate array with shape (60000, 28, 28) and data ty
因為ubunutu似乎要占用的空間太大,所以系統就提前禁止創建了。實際上是用不了那么多內存的
解決辦法
首先檢查系統的內存過載處理模式
$ cat /proc/sys/vm/overcommit_memory
不出意外的話結果應該是0
然后切換到 root 用戶(否則權限不夠)
$ sudo passwd root
然后輸入當前用戶密碼,再給 root 設定一個新密碼,再切換到 root:
$su root
你會發現KaTeX parse error: Expected 'EOF', got '#' at position 4: 變成了#? 現在我們擁有了 root 權… echo 1 > /proc/sys/vm/overcommit_memory`
然后不出意外的話,就可以成功創建該矩陣啦!
總結
以上是生活随笔為你收集整理的memoryerror: Unable to allocate array with shape (60000, 28, 28) and data ty的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 怎么不能格式化c盘 格式化C盘失败怎么办
- 下一篇: u盘怎么压缩 U盘压缩方法简介