将稀疏矩阵压缩时用的tensorflow.sparse_to_tense函数,报错Cannot create a tensor proto whose content is larger than 2GB,这个问题要怎么解决啊?老师给我们的数据集最大的一个有10GB,才接触TensorFlow,不知道怎么处理,麻烦大神们帮帮忙!
1条回答 默认 最新
- COCO_AS 2017-12-05 13:42关注
这里有解决办法
https://stackoverflow.com/questions/38087342/use-large-dataset-in-tensorflow搬过来供你参考
Do not load data to constant, it will be part of your computational graph.
You should rather:
Create an op which is loading your data in stream fashion Load data in python part, and use feed_dict to pass the batch into the graph
For TensorFlow 1.x and Python 3, there is my simple solution:
X_init = tf.placeholder(tf.float32, shape=(m_input, n_input)) X = tf.Variable(X_init) sess.run(tf.global_variables_initializer(), feed_dict={X_init: data_for_X})
In practice, you will mostly specify Graph and Session for continuous computation, this following code will help you:
my_graph = tf.Graph() sess = tf.Session(graph=my_graph) with my_graph.as_default(): X_init = tf.placeholder(tf.float32, shape=(m_input, n_input)) X = tf.Variable(X_init) sess.run(tf.global_variables_initializer(), feed_dict={X_init: data_for_X}) .... # build your graph with X here .... # Do some other things here with my_graph.as_default(): output_y = sess.run(your_graph_output, feed_dict={other_placeholder: other_data})
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 metadata提取的PDF元数据,如何转换为一个Excel
- ¥15 关于arduino编程toCharArray()函数的使用
- ¥100 vc++混合CEF采用CLR方式编译报错
- ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
- ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
- ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
- ¥50 如何openEuler 22.03上安装配置drbd
- ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
- ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
- ¥15 Windows11, backspace, enter, space键失灵