torch.where() 用于将两个broadcastable的tensor组合成新的tensor,类似于c++中的三元操作符“?:”
区别于python numpy中的where()直接可以找到特定条件元素的index
Pytorch tensor特定条件判断索引

想要实现numpy中where()的功能,可以借助nonzero()
Pytorch tensor特定条件判断索引
对应numpy中的where()操作效果:
Pytorch tensor特定条件判断索引

相关文章:

  • 2021-06-27
  • 2022-12-23
  • 2021-10-19
猜你喜欢
  • 2020-03-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案