S676951 2017-12-05 13:00 采纳率: 100%
浏览 8083
已采纳

如何解决Tensorflow数据集太大的问题?

将稀疏矩阵压缩时用的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})
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 已采纳回答 9月16日

悬赏问题

  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
  • ¥15 Arcgis相交分析无法绘制一个或多个图形
  • ¥15 关于#r语言#的问题:差异分析前数据准备,报错Error in data[, sampleName1] : subscript out of bounds请问怎么解决呀以下是全部代码:
  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误