pytorch torch.where用法

pytorch torch.where()函数用法

torch.where(condition, x, y) → Tensor

函数的作用

根据条件,返回从x,y中选择元素所组成的张量。如果满足条件,则返回x中元素。若不满足,返回y中元素。
在这里插入图片描述

例子

在这里插入图片描述

发布了131 篇原创文章 · 获赞 6 · 访问量 6919

猜你喜欢

转载自blog.csdn.net/Orientliu96/article/details/104827391
今日推荐