[Depth study notes] torch.unsqueeze ()

tags: Study notes  Depth study  

First, the role

Mainly to expand the data dimension. To the specified position, add dimensions of dimensions 1, such as data (3) originally 4 rows (3), which will be 1 row 4 columns (1, 3). A.unsqueeze (n) is a dimension of 1 dimension of 1 plus a dimension of 1 in the specified position n in A. There is also a form is that b = torch.unsqueeze (a, n) a is a dimension of the position N plus a dimension of 1 in the specified position n in A.

Second, the example

x = torch.tensor([1, 2, 3, 4])

torch.unsqueeze(x, 0).size()
RESULTS: Torch.Size([1, 4])

torch.unsqueeze(x, 1).size()
 RESULTS: Torch.Size([4, 1])

Intelligent Recommendation

Depth study notes (d)

M gradients in the samples decreases To distinguish between loss function and the difference between the cost function: function loss in the single sample; cost function on a plurality of samples is, ...

Depth study notes [two]

mIoU Calculation method: p_ij represents the class i is identified as the total number of pixels class j, i.e. p_ii represented identify the correct real Example (True Positive, TP) the total number, ...

"In-depth mysql" study notes

One: SQL classification and grammar 1.sql classification: (1) DDL: database definition language, used to define database objects such as tables, columns, and indexes. create, drop, alter, etc. (2) DML...

float in-depth study notes

The original intention of float: just to achieve the text wrapping effect Perceptual perception of float: Wrapping: 1. Shrinking: After applying float to the element, the width shrinks to tightly wrap...

More Recommendation

border in-depth study notes

The border-style property sets the styles of the four borders of an element. This attribute can have one to four values. Examples: border-style:dotted solid double dashed; The top border is dotted The...

Absolute in-depth study notes

The brother relationship between absolute and float: Both are wrapped (after applying absolute positioning to the parent element, the width of the parent element will shrink, but it will remain wrappe...

VueRouter in-depth study notes

One, know routing 1] What is routing? **Routing** is the activity of transferring information from a source address to a destination address through an interconnected network. - Wikipedia The router p...

Spring in-depth study notes

Advantages of Spring: Decoupling, simplifying development Through the IoC container provided by Spring, the dependencies between objects can be controlled by Spring to avoid hard coding. Excessive pro...

In-depth, Mybatis study notes

The ORM (Object Relational Map) model is a database of tables and simple Java objects (POJO) mapping relationship models. Hibernate shortcomings: The inconvenience caused by full table mapping, such a...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top