当前位置:网站首页>[pytorch 07] hands on deep learning chapter_ Preliminaries/ndarray exercises hands-on version
[pytorch 07] hands on deep learning chapter_ Preliminaries/ndarray exercises hands-on version
2022-07-07 10:44:00 【ECCUSXR】
Catalog
3. Through tensor shape Property to access the tensor x( Length along each axis ) The shape of the
4. Just want to know the total number of elements in the tensor , You can check its size (size)
5. Put tensor x From shape to (12,) The row vector of is transformed into a shape of (3,4) Matrix .
6. Create a shape as (2,3,4) Tensor , All elements are set to 0.
7. Create a shape as (2,3,4) Tensor , All elements are set to 1.
9. torch.tensor Create a (3,4) Two dimensional array of .
10. Realize the addition, subtraction, multiplication and division of the following two arrays
11. Exponentiate the following array
12. The following two arrays , Press the line / Splicing by columns
13. Judge whether each element of the following two homogeneous arrays is equal
14. Calculation X The sum of all elements in the array
15. Use arange Create a 3*1 Array of a and 1*2 Array of b
16. Try adding the above two arrays directly , View the situation .
19、 Modify two-dimensional array X The first 0 Xing He 1 All elements of the row are 12.
20、 take X Turn into numpy Assign to A, then A Turn into tensor In the form of B
21、 Output a Original number of 、 Character 、 floating-point
1. Import torch
2. Use arange Create a row vector x, This row vector contains the following elements 0 Before we start 12 It's an integer .
3. Through tensor shape Property to access the tensor x( Length along each axis ) Of shape
4. Just want to know the total number of elements in the tensor , You can check its size (size)
5. Put tensor x From shape to (12,) The row vector of is transformed into a shape of (3,4) Matrix .
6. Create a shape as (2,3,4) Tensor , All elements are set to 0.
7. Create a shape as (2,3,4) Tensor , All elements are set to 1.
8. Create a shape as (3,4) Tensor . Each of these elements has a mean value of 0、 The standard deviation is 1 The standard Gaussian distribution of ( Normal distribution ) Medium random sampling .
9. torch.tensor Create a (3,4) Two dimensional array of .
【 Operator 】
10. Realize the addition, subtraction, multiplication and division of the following two arrays
x = torch.tensor([1.0, 2, 4, 8])
y = torch.tensor([2, 2, 2, 2])11. Exponentiate the following array
x = torch.tensor([1.0, 2, 4, 8])12. The following two arrays , Press the line / Splicing by columns
X = torch.arange(12, dtype=torch.float32).reshape((3,4))
Y = torch.tensor([[2.0, 1, 4, 3], [1, 2, 3, 4], [4, 3, 2, 1]])13. Judge whether each element of the following two homogeneous arrays is equal
X = torch.arange(12, dtype=torch.float32).reshape((3,4))
Y = torch.tensor([[2.0, 1, 4, 3], [1, 2, 3, 4], [4, 3, 2, 1]])14. Calculation X The sum of all elements in the array
X = torch.arange(12, dtype=torch.float32).reshape((3,4))【 Broadcast mechanism 】
15. Use arange Create a 3*1 Array of a and 1*2 Array of b
16. Try adding the above two arrays directly , View the situation .
【 Index and slice 】
17. Take out the two-dimensional array X in choice The last line of elements 、 The second to third lines of elements
X = torch.arange(12, dtype=torch.float32).reshape((3,4))18、 Modify two-dimensional array X The first 1 Xing di 2 The value of the column is 9 and Write matrix
X = torch.arange(12, dtype=torch.float32).reshape((3,4))19、 Modify two-dimensional array X The first 0 Xing He 1 All elements of the row are 12.
X = torch.arange(12, dtype=torch.float32).reshape((3,4))【 Convert objects 】
20、 take X Turn into numpy Assign to A, then A Turn into tensor In the form of B
X = torch.arange(12, dtype=torch.float32).reshape((3,4))21、 Output a Original number of 、 Character 、 floating-point
a = torch.tensor([3.5])边栏推荐
- What is an intermediate network engineer? What is the main test and what is the use?
- Multithreaded asynchronous orchestration
- MONAI版本更新到 0.9 啦,看看有什么新功能
- Find the root of equation ax^2+bx+c=0 (C language)
- 使用Tansformer分割三维腹部多器官--UNETR实战
- 一些线上学术报告网站与机器学习视频
- What does intermediate software evaluator test
- [recommendation system 01] rechub
- Mendeley--免费的文献管理工具,给论文自动插入参考文献
- 2022年7月10日“五心公益”活动通知+报名入口(二维码)
猜你喜欢

Talking about the return format in the log, encapsulation format handling, exception handling

如何顺利通过下半年的高级系统架构设计师?

2022年7月10日“五心公益”活动通知+报名入口(二维码)
![1323: [example 6.5] activity selection](/img/2e/ba74f1c56b8a180399e5d3172c7b6d.png)
1323: [example 6.5] activity selection

Using U2 net deep network to realize -- certificate photo generation program

软考中级有用吗??

IO model review

Trajectory planning for multi-robot systems: Methods and applications 综述阅读笔记

P2788 math 1 - addition and subtraction

软考信息处理技术员有哪些备考资料与方法?
随机推荐
Jump to the mobile terminal page or PC terminal page according to the device information
555电路详解
宁愿把简单的问题说一百遍,也不把复杂的问题做一遍
Multisim--软件相关使用技巧
@Configuration, use, principle and precautions of transmission:
IO model review
使用 load_decathlon_datalist (MONAI)快速加载JSON数据
JS implementation chain call
成为优秀的TS体操高手 之 TS 类型体操前置知识储备
对word2vec的一些浅层理解
What are the contents of the intermediate soft test, the software designer test, and the test outline?
Schnuka: machine vision positioning technology machine vision positioning principle
一些线上学术报告网站与机器学习视频
[système recommandé 01] rechub
Find the greatest common divisor and the least common multiple (C language)
P2788 数学1(math1)- 加减算式
1324: [example 6.6] integer interval
Installation and configuration of slurm resource management and job scheduling system
What does intermediate software evaluator test
ADB utility commands (network package, log, tuning related)