一、where

1)torch.where(condition, x, y)  # condition是条件,满足条件就返回x,不满足就返回y

2)特点,相比for循环的优点是:可以布置在GPU上运行

 

二、gather

1)官方解释:根据指定的维度和索引值来筛选值

 2)举例

 

posted on 2020-03-29 16:57  jaysonteng  阅读(2713)  评论(1编辑  收藏  举报