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 (将#修改为@)