为什么会这样tf.read\u文件()和tf.decode\u原始()更改大小?

2024-04-23 06:03:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我想上传一个npy文件到tensor。所以我在tf.read_file()之后使用了tf.decode_raw(),但是值和大小与原始npy文件不同。不能改进吗?(我知道它和tf.convert_to_tensor()一起工作,但是我认为我应该用read_file()来做tf.train.slice_input_producer()来运行深度学习。)你知道吗

file_reader = tf.read_file('./data/test_LR/T2_npy/T2_168_C6M5_1.npy')
ab = tf.decode_raw(file_reader, out_type = tf.uint8)
sess = tf.Session()
a = sess.run(ab)
print(np.shape(a))

# result
(49280,)
an = np.load('./data/test_LR/T2_npy/T2_168_C6M5_1.npy')
print(np.shape(an))

# result
(192,256) -> 49152

Tags: 文件testreaddatarawtfnpreader