前言

 

1. torch.where

【pytorch基础】满足条件的元素赋值

 

 返回满足条件的x/y;

The tensors conditionxy must be broadcastable.

注意,不同pytorch版本的输入输出数据类型有可能不同。1.6版本x/y输入类型只有Tensor,1.9版本是Tensor or Scalar。

2. 满足条件的索引

 

3. 满足条件的元素赋值

 

 

参考

1. torch.where;

2. Pytorch tensor特定条件判断索引;

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
  • 2022-12-23
  • 2022-02-16
  • 2021-06-10
  • 2021-05-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-25
  • 2022-02-24
  • 2021-06-14
  • 2022-01-16
  • 2021-09-13
  • 2021-10-04
相关资源
相似解决方案