TensorFlow Allocation of 1511424000 exceeds 10% of system memory

在使用TensorFlow神经网络新手教程进行2,3,1结构的一隐层神经网络模型训练时,遇到内存溢出问题。文章探讨了是否由于电脑配置(i5-4210U,4G内存)过低导致此问题,或是数据导入环节出现错误。
部署运行你感兴趣的模型镜像

在利用TensorFlow社区的神经网络新手教程的一个例程时,遇到了一个因为内存问题而导致电脑卡主没反应的问题,本次神经网络的模型为一隐层的神经网络模型(2,3,1结构),在训练过程中,出现了内存的问题。
print(‘test accuracy %.3f’%accuracy.eval(feed_dict={
x: mnist.test.images, y_label: mnist.test.labels, keep_prop: 1.0})),报错Allocation of 31360000 exceeds 10% of system memory.这是因为电脑配置(i5-4210U,4G内存)过低的原因吗?还是因为导入数据是出问题了?

您可能感兴趣的与本文相关的镜像

TensorFlow-v2.15

TensorFlow-v2.15

TensorFlow

TensorFlow 是由Google Brain 团队开发的开源机器学习框架,广泛应用于深度学习研究和生产环境。 它提供了一个灵活的平台,用于构建和训练各种机器学习模型

The references do not directly mention memory allocation and deallocation functions that should not be used. However, in general programming practices, some functions may be considered less favorable in certain scenarios. For example, in C++, while `malloc` and `free` from the C standard library can be used for memory allocation and deallocation, they are generally not recommended when working with C++ classes and objects. `malloc` only allocates raw memory and does not call the constructor of the object, and `free` only deallocates the memory without calling the destructor. In contrast, `new` and `delete` (or `new[]` and `delete[]`) in C++ are designed to handle object construction and destruction properly. Using `malloc` and `free` for C++ objects can lead to issues such as uninitialized objects and memory leaks due to non - called destructors [^1][^3]. Another aspect is that using `new` and `delete` inappropriately can also cause problems. For instance, if you allocate an array with `new[]`, you must use `delete[]` to deallocate it. Using `delete` instead of `delete[]` when dealing with an array allocated by `new[]` can result in undefined behavior, typically memory leaks and potential crashes [^3]. ```cpp #include <iostream> class MyClass { public: MyClass() { std::cout << "Constructor called" << std::endl; } ~MyClass() { std::cout << "Destructor called" << std::endl; } }; int main() { // Bad practice: using malloc for a C++ object MyClass* obj = (MyClass*)malloc(sizeof(MyClass)); // Constructor is not called here free(obj); // Destructor is not called here // Correct way in C++ MyClass* obj2 = new MyClass(); delete obj2; // Bad practice: incorrect deallocation of array MyClass* arr = new MyClass[5]; delete arr; // Should be delete[] arr; return 0; } ```
评论 12
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值