tensorflow2.0获取某个维度的部分数据,如下:
import tensorflow as tf a = tf.random.uniform((4, 5)) # 方法一 b = a[::2] # 方法二 c = tf.boolean_mask(a, [True, False, True, False], axis=0) # 方法三 d = tf.gather(a, [0, 2], axis=0)
浙公网安备 33010602006230号
浙ICP备14015892号