import tensorflow as tf
import numpy as np
#往列存数据
X = np.linspace(1,100,100).reshape(1,100)
x = tf.placeholder(dtype=tf.int32, shape=[1, None])
with tf.Session() as sess:
out = sess.run(x, feed_dict = {x:X[:,4:9]})
print(out)
#往行存数据
Y = np.linspace(1,100,100).reshape(100,1)
y= tf.placeholder(dtype=tf.int32, shape=[None, 1])
with tf.Session() as sess:
out = sess.run(y, feed_dict = {y:Y[4:9]})
print(out)
output:
[[5 6 7 8 9]]
[[5]
[6]
[7]
[8]
[9]]