一、where

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

pytorch高阶OP操作where,gather

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

pytorch高阶OP操作where,gather

 

二、gather

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

pytorch高阶OP操作where,gather

 2)举例

pytorch高阶OP操作where,gather

 

相关文章:

  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2020-09-30
  • 2021-04-18
  • 2022-01-05
  • 2021-08-16
  • 2022-12-23
猜你喜欢
  • 2021-05-28
  • 2021-12-23
  • 2022-12-23
  • 2021-06-03
  • 2021-05-25
  • 2021-08-23
  • 2021-05-06
相关资源
相似解决方案