当前位置:网站首页>torch. unbind()
torch. unbind()
2022-06-11 08:11:00 【Interval】
effect : The length of a dimension is 1 The section of , And return all slicing results .
Take an example :
import torch
x = torch.tensor([[1, 2],[ 3,4]])
torch.unbind(x,0)# The first 0 On dimensions, the length is 1 The section of .
result :
(tensor([1, 2]), tensor([3, 4]))
Application reduces the amount of code :
m,n=torch.unbind(x,0)
print(m)
print(n)
m,n=x[0],x[1]# Although this is OK , But if x The first dimension of is very big , This is very complicated .
print(m)
print(n)
result :
tensor([1, 2])
tensor([3, 4])
tensor([1, 2])
tensor([3, 4])
Add another torch.unbind() The equivalent form of :
x.unbind(0)
result :
(tensor([1, 2]), tensor([3, 4]))
边栏推荐
- Record a murder case caused by ignoring the @suppresslint ("newapi") prompt
- Layout of code setting constraintlayout_ constraintDimensionRatio
- 2022.6.7 special student simulation
- JS learning basics document Write write a line of text in the page
- (transformation) tree, binary tree and forest transformation principle
- TypeScript-声明合并
- Bladed入門教程(視頻)
- 图数据库无缝集成Tushare接口
- AttributeError: module ‘tensorflow. compat. v2.__ internal__‘ has no attribute ‘register_ clear_ session_
- El expressions and JSTL
猜你喜欢

How to make hyperlinks in RichTextBox- How can I make a hyperlink work in a RichTextBox?

Training yolov4 CSP model using coco dataset

Understanding of Poisson distribution and Poisson process and Erlang distribution and their relations (important theories in queuing theory and operational research)

Servlet

这几个小工具也太好用了

签到体系设计:签到功能该怎么画

TiDB Cloud 上線 Google Cloud Marketplace,以全新一棧式實時 HTAP 數據庫賦能全球開發者

Solve ('You must install pydot (`pip install pydot`) and install graphviz (see...) '‘ for plot_ model..

JS learning basics document Write write a line of text in the page

Typescript header file usage details
随机推荐
Logical implication of functional dependence
How to output the percent sign "%" in printf function in C language
自定义ViewGroup的知识点总结-持续更新
Session and session management technology
[transfer] two-way merging and sorting of C language
Switch statement
Bubble sorting with C language
Note: JDBC
Typescript unknown type
How to start participating in the open source community
In an activity, view postdelay will cause memory leakage, but will not affect the life cycle execution of the activity.
使用 COCO 数据集训练 YOLOv4-CSP 模型
Record a murder case caused by ignoring the @suppresslint ("newapi") prompt
Summary of force deduction questions
Jupyter notebook code completion plug-in + Solution
学习《缠解论语》
El expressions and JSTL
TiDB Cloud 上线 Google Cloud Marketplace,以全新一栈式实时 HTAP 数据库赋能全球开发者
[the most complete ENSP [installation diagram] in history!]
C language to achieve a simple game - minesweeping