当前位置:网站首页>torch.where的新用法(很老但是大家忽略的用法)
torch.where的新用法(很老但是大家忽略的用法)
2022-06-12 18:04:00 【znsoft】
torch.where(condition) → tuple of LongTensor
torch.where(condition) is identical to torch.nonzero(condition, as_tuple=True).
通常 ,我们都 会这样使用torch.where函数:
torch.where(condition, x, y)
但是实际上torch.where还有如题头如示的用法,返回tuple.
tuple中是condition中符合条件的值的index.
比如
a=[1,2,3,4,5]
torch.where(a>3)
返回( 3,4)
边栏推荐
- Extreme Programming -- Practice of root cause analysis
- Esp-idf adds its own components
- 用好IDE,研发效能提速100%
- 机器学习系列(5):朴素贝叶斯
- PHP implementation of infinite classification tree (recursion and Optimization)
- JS quick sort
- Channel Original
- Leetcode151 flipping words in strings
- Office application cannot start normally 0xc0000142
- 一种好用、易上手的小程序IDE
猜你喜欢

SSM integrates FreeMarker and common syntax

HTTP cache < strong cache and negotiation cache >

Byte flybook Human Resources Kit three sides

机器学习系列(5):朴素贝叶斯

High speed layout guidelines incomplete

Extreme Programming -- Practice of root cause analysis

The server time zone value ‘�й���ʱ��‘ is unrecognized or represents more than one time zone. ......

Small program +app, a low-cost and active technology combination idea

USB to serial port - maximum peak serial port baud rate vs maximum continuous communication baud rate

DRM driven MMAP detailed explanation: (I) preliminary knowledge
随机推荐
Vant3+ts encapsulates uploader upload image component
Channel Original
The server time zone value ‘�й���ʱ��‘ is unrecognized or represents more than one time zone. ......
118. Yanghui triangle (dynamic planning)
Stream流注意点
vant3+ts 封装uploader上传图片组件
Error record: illegalstateexception: optional int parameter 'XXXX' is
Reconnaître l'originalité de la fonction
C#简单介绍
leetcode491 递增子序列
Gossip about the source code of redis 89
NixOS 22.05安装过程记录
js将数组中的0移动到末尾
JS dichotomy
Lightweight and convenient small program to app technology solution to realize interconnection with wechat / traffic app
The server time zone value ‘� й ��� ʱ ��‘ is unrecognized or represents more than one time zone. ......
A story on the cloud of the Centennial Olympic Games belonging to Alibaba cloud video cloud
机器学习系列(3):Logistic回归
Leetcode151 flipping words in strings
Random talk about redis source code 90