# 2.1Pytorch Basic Exercise

**transpose()**Only operate two dimensions at a time

Function Returns the input matrix**input**The transposition. Exchange dimension**dim0**and**dim1**

- NPut (Tensor) – Enter a tensive, required
- DIM0 (int) – Transposed first dimension, default 0, optional
- DIM1 (int) – Secondary, default 1, optional

One is a uniform distribution, one is a standard normal distribution.

# 2.2 Spiral Data Classification

Linux system*wget*is a tool for downloading a file

(1) Tensor and Numpy are matrices, the difference is that the former can run on the GPU, which can only be on the CPU;

(2) Tensor and Numpy are very convenient to transform each other, and the type is also compatible.

Representative Use CPU, and**device=torch.device("cpu")**

The represented GPU is used.**device=torch.device("cuda")**

When we specify the device, we need to load the model to the corresponding device, and it needs to be used.

Load the model into the corresponding device.**model=model.to(device)**

Some of the neural network structure is partially improved, and a hidden layer is added between the input and output layers, and the RELU activation function has been added, which constitutes a simple 3-layer neural network, input-hidden layer-output, but this is enough to achieve Very good nonlinearity.