tensorflow2.1的索引与切片

上传:miaodayang 浏览: 15 推荐: 0 文件:PDF 大小:36.02KB 上传时间:2020-12-23 04:01:17 版权申诉
1、常规索引 直接索引 import tensorflow as tf a = tf.ones([1, 5, 5, 3]) a[0][0] Out[5]: a[0][0][0] Out[6]: a[0][0][0][2] Out[7]: numpy风格的索引 a = tf.random.normal([4, 28, 28, 3]) a[1].shape Out[11]: TensorShape([28, 28, 3]) a[1, 2].shape Out[12]: TensorShape([28, 3]) a[1, 2, 3].shape Out[13]: TensorShape([3])
上传资源
用户评论