1. Basic data: Tensor
1. Tensor combination and block
combination
Refers to a combination of different operations Tensor
add up, there are torch.cat()
and torch.stack()
two functions.
torch.cat()
: That isconcatenate
, it refers to splicing along a certain dimension of the existing data. After the operation, the total dimensionality of the data remains unchanged. When splicing, except for the splicing dimension, other dimensions must be the same.torch.stack()
: Refers to the newly added dimension, which is superimposed according to the specified dimension.
Block
Block operation is opposite to a combination, refers Tensor
divided into different sub Tensor
, main torch.chunk()
and torch.split()
two functions.
torch.chunk()
: Need to specify the number of blockstorch.split()
: Need to specify the size of each block