torch.tensor(data, *, dtype=None, device=None, requires_grad=False, pin_memory=False) → Tensorconstructs a tensor with no autograd history (a.k.a. a "leaf tensor") by copying data.
Tensor.shapereturns the size of the self tensor.
Tensor.size(dim=None) → torch.Size or intreturns the size of the self tensor. If dim is not specified, the returned value is a torch.Size, a subclass of tuple. If dim is specified, returns an int holding the size of that dimension.

torch.arange(start=0, end, step=1, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) → Tensorreturns a 1-D tensor of size £[\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil£] with values from the interval [start, end) taken with common difference step beginning from start.
torch.rand(*size, *, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) → Tensorreturns a tensor filled with random numbers from a uniform distribution on the interval [0,1)[0,1) The shape of the tensor is defined by the variable argument size.
torch.randint(low=0, high, size, \*, generator=None, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) → Tensorreturns a tensor filled with random integers generated uniformly between low (inclusive) and high (exclusive). The shape of the tensor is defined by the variable argument size.
torch.multinomial(input, num_samples, replacement=False, *, generator=None, out=None) → LongTensorreturns a tensor where each row contains num_samples indices sampled from the multinomial probability distribution located in the corresponding row of tensor input.

Tensor.view(*shape) → Tensorreturns a new tensor with the same data as the self tensor but of a different shape.
torch.cat(tensors, dim=0, *, out=None) → Tensorconcatenates the given sequence of seq tensors in the given dimension. All tensors must either have the same shape (except in the concatenating dimension) or be empty.
#> t1 = torch.tensor([[1, 2, 3], [4, 5, 6]])
#> t2 = torch.tensor([[11, 12, 13], [14, 15, 16], [17, 18, 19]])
#> t3 = torch.cat((t1, t2))
#> print(t1, t2, t3, sep='\n')
tensor([[1, 2, 3],
        [4, 5, 6]])
tensor([[11, 12, 13],
        [14, 15, 16],
        [17, 18, 19]])
tensor([[ 1,  2,  3],
        [ 4,  5,  6],
        [11, 12, 13],
        [14, 15, 16],
        [17, 18, 19]])
torch.tril(input, diagonal=0, *, out=None) → Tensorreturns the lower triangular part of the matrix (2-D tensor) or batch of matrices input, the other elements of the result tensor out are set to 0.
torch.triu(input, diagonal=0, *, out=None) → Tensorreturns the upper triangular part of the matrix (2-D tensor) or batch of matrices input, the other elements of the result tensor out are set to 0.
torch.exp(input, *, out=None) → Tensorreturns a new tensor with the exponential of the elements of the input tensor input.
torch.nn.Softmax(dim=None)applies the Softmax function to an n-dimensional input Tensor rescaling them so that the elements of the n-dimensional output Tensor lie in the range [0,1] and sum to 1.
torch.transpose(input, dim0, dim1) → Tensorreturns a tensor that is a transposed version of input. The given dimensions dim0 and dim1 are swapped.
torch.stack(tensors, dim=0, *, out=None) → Tensorconcatenates a sequence of tensors along a new dimension. All tensors need to be of the same size.
torch.mm(input, mat2, *, out=None) → Tensorperforms a matrix multiplication of the matrices input and mat2.
torch.matmul(input, other, *, out=None) → Tensorperforms a matrix product of two tensors. The behaviour depends on the dimensionality of the tensors.
The @ operand can also be used to multiply two tensors.
torch.save(obj, f, pickle_module=pickle, pickle_protocol=DEFAULT_PROTOCOL, _use_new_zipfile_serialization=True)saves an object to a disk file.
torch.load(f, map_location=None, pickle_module=pickle, *, weights_only=False, mmap=None, **pickle_load_args)loads an object saved with torch.save() from a file.

Activation functions
torch.nn.ReLU(inplace=False)applies the rectified linear unit function element-wise.
torch.nn.Sigmoid(*args, **kwargs)Applies the element-wise function:£[\text{Sigmoid}(x) = \sigma(x) = \frac{1}{1 + \exp(-x)}£].
torch.nn.Softmax(dim=None)applies the Softmax function to an n-dimensional input Tensor rescaling them so that the elements of the n-dimensional output Tensor lie in the range [0,1] and sum to 1.

Loss functions
torch.nn.BCELoss(weight=None, size_average=None, reduce=None, reduction='mean')creates a criterion that measures the Binary Cross Entropy between the target and the input probabilities.
torch.nn.CrossEntropyLoss(weight=None, size_average=None, ignore_index=-100, reduce=None, reduction='mean', label_smoothing=0.0)creates a criterion that computes the cross entropy loss between input logits and target.
torch.nn.NLLLoss(weight=None, size_average=None, ignore_index=-100, reduce=None, reduction='mean')The negative log likelihood loss. It is useful to train a classification problem with C classes.
torch.nn.MSELoss(size_average=None, reduce=None, reduction='mean')creates a criterion that measures the mean squared error (squared L2 norm) between each element in the input xx and target yy.

The optimizers are listed here.