1)torch.where(condition, x, y) # condition是条件,满足条件就返回x,不满足就返回y
2)特点,相比for循环的优点是:可以布置在GPU上运行
1)官方解释:根据指定的维度和索引值来筛选值
2)举例