python - Keras 小型网络占用大量 GPU 内存
问题描述
我有一个非常小的神经网络 -
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
scores_input (InputL (None, 2) 0
_________________________________________________________________
dense1 (Dense) (None, 1) 2
_________________________________________________________________
bn (BatchNormalizati (None, 1) 4
_________________________________________________________________
sigmoid (Activation) (None, 1) 0
=================================================================
Total params: 6
Trainable params: 4
Non-trainable params: 2
但是,如 nvidia-smi 所示,它需要大约 1.3 GB 的 gpu 内存
Wed Aug 28 08:41:38 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.130 Driver Version: 384.130 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 960 Off | 00000000:01:00.0 On | N/A |
| 30% 42C P2 29W / 120W | 1763MiB / 1988MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1258 G /usr/lib/xorg/Xorg 251MiB |
| 0 2336 G compiz 231MiB |
| 0 25537 G .../innereye/qtcreator-4.9.2/bin/qtcreator 2MiB |
| 0 30098 G ...-token=DA8EE4CD7070EDEBCD3537BAAD982629 37MiB |
| 0 30436 C python 1227MiB |
+-----------------------------------------------------------------------------+
我需要加载另一个(更大的)网络,但它们不适合 GPU 内存。有什么帮助吗?
解决方案
推荐阅读
- css - Webpack 块样式和 react.lazy
- reactjs - reactjs点击后如何依次显示json文件内容
- swiftui - SwiftUI 中的全局与本地
- python - 用 groupby.sum() 对大型稀疏熊猫数据帧进行分组非常慢
- python-3.x - 我将如何递归地从嵌套列表中获取唯一项?
- azure-databricks - Databricks 小部件面板默认设置
- javascript - Handlebars:html 在控制台中打印但不呈现
- java - Spring boot:部署为war时如何读取驻留在Tomcat中的外部文件
- java - 您如何使用 Java 开发工具包访问受 IAM 角色保护的 S3 存储桶?
- java - 模拟手势