0
点赞
收藏
分享

微信扫一扫

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

前言

 

1. torch.where

【pytorch基础】满足条件的元素赋值_数据类型

 

 返回满足条件的x/y;

The tensors ​​condition​​​, ​​x​​​, ​​y​​​ must be ​​broadcastable​​.

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

2. 满足条件的索引

 

3. 满足条件的元素赋值

 

 

参考

1. ​​torch.where​​;

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

 

举报

相关推荐

0 条评论