原文:tf.gather()、tf.gather_nd()、tf.batch_gather()、tf.where()和tf.slice()

.tf.gather tf.gather params, indices, validate indices None, name None, axis 功能:根据提供的 indices在 axis这个轴上对 params进行索引,拼接成一个新的张量。 参数: params:需要被索引的张量 indices:必须为整数类型,如int ,int 等,注意检查不要越界了,因为如果越界了,如果使用的C ...

2019-07-31 14:45 0 1186 推荐指数:

查看详情

[tensorflow] tf.gather使用方法

tf.gather:用一个一维的索引数组,将张量中对应索引的向量提取出来 import tensorflow as tf a = tf.Variable([[1,2,3,4,5], [6,7,8,9,10], [11,12,13,14,15]]) index_a ...

Tue Dec 04 19:25:00 CST 2018 0 20011
tf.gather,取指定维度多个索引的数据

tensorflow和numpy在数据处理上语法相似但又不完全一样,比如在numpy中想取指定维度的多个指定索引所指向的数据时,直接用一个列表保存索引就能直接取,比如: 但是若b是tensor形式,则上述操作会报错! 而在tensor中则需要使用tf.gather方法来 ...

Fri Jul 03 20:11:00 CST 2020 0 650
tensorflow之tf.slice()

转载:https://www.jianshu.com/p/71e6ef6c121b    https://www.cnblogs.com/chamie/p/11073363.html ...

Mon Jun 24 03:50:00 CST 2019 0 1146
tf.slice函数解析

tf.slice函数解析 觉得有用的话,欢迎一起讨论相互学习~ tf.slice(input_, begin, size, name = None) 解释 : 这个函数的作用是从输入数据input中提取出一块切片 切片的尺寸是size,切片的开始位置是begin ...

Thu Feb 22 03:25:00 CST 2018 0 6477
tensorflow 的tf.where详解

最近在用到数据筛选,观看代码中有tf.where()的用法,不是很常用,也不是很好理解。在这里记录一下 Return the elements, either from x or y, depending on the condition. 理解:where嘛,就是要根据条件找到 ...

Thu Jan 03 01:12:00 CST 2019 0 1036
tf.where()函数的解析

验证一维矩阵,tf.where()返回的索引:[[0] [1] [2] [3] [4]]验证三维矩阵,tf.where()返回的索引:[[0 0] [0 1] [0 2] [0 3] [0 4] [1 0] [1 1] [1 2] [1 3]]验证三维矩阵,tf.where()返回的索引:[[0 0 0] [0 0 1] [0 0 2] [0 0 3] [0 0 4] [0 1 0] [0 1 ...

Wed Dec 11 06:13:00 CST 2019 0 683
tf.slice()函数详解(极详细)

目录 1.官方注释 2.参数解释 3.例子 参考 tf.slice()是TensorFlow库中分割张量的一个函数,其定义为def slice(input_, begin, size, name=None):。tf.slice()函数的那些参数设置实在是 ...

Sun Mar 22 01:34:00 CST 2020 0 4063
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM