微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

tf 1.15无限期挂在sess.run上

如何解决tf 1.15无限期挂在sess.run上

我正在尝试完成一个简单的任务,将张量从大小为1.5MB的tf.record文件转换为NumPy。
到目前为止,这就是我所做的事情,不幸的是,代码无限期地挂在data_vol.eval()


    decomp_feature = {
            'dsize_dim0': tf.FixedLenFeature([],tf.int64),'dsize_dim1': tf.FixedLenFeature([],'dsize_dim2': tf.FixedLenFeature([],'lsize_dim0': tf.FixedLenFeature([],'lsize_dim1': tf.FixedLenFeature([],'lsize_dim2': tf.FixedLenFeature([],'data_vol': tf.FixedLenFeature([],tf.string),'label_vol': tf.FixedLenFeature([],tf.string)}
    raw_size = [256,256,3] # original raw input size
    volume_size = [256,3] # volume size after processing

    reader =  tf.TFRecordReader()
    file_example = "output/tmp/image_01.tfrecords"
    filename_queue = tf.train.string_input_producer(
        [file_example],num_epochs=1)

    fid,serialized_example = reader.read(filename_queue)
    parser = tf.parse_single_example(serialized_example,features = decomp_feature)
    data_vol = tf.decode_raw(parser['data_vol'],tf.float32)

    data_vol = tf.reshape(data_vol,raw_size)
    data_vol = tf.slice(data_vol,[0,0],volume_size)
    with tf.Session() as sess:  
        ### Tried without initializing and finalizing the graph,same problem ###
        sess.run(tf.initialize_all_variables())
        sess.graph.finalize()
        ######################

        sess.run(data_vol).eval()
        a = data_vol.eval() < --- stuck

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。