torch.arange(start=0, end, step=1, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) → Tensor | returns 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) → Tensor | returns 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) → Tensor | returns 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) → LongTensor | returns 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) → Tensor | returns a new tensor with the same data as the self tensor but of a different shape. |
torch.cat(tensors, dim=0, *, out=None) → Tensor | concatenates 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) → Tensor | returns 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) → Tensor | returns 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) → Tensor | returns 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) → Tensor | returns a tensor that is a transposed version of input . The given dimensions dim0 and dim1 are swapped. |
torch.stack(tensors, dim=0, *, out=None) → Tensor | concatenates a sequence of tensors along a new dimension. All tensors need to be of the same size. |
torch.mm(input, mat2, *, out=None) → Tensor | performs a matrix multiplication of the matrices input and mat2 . |
torch.matmul(input, other, *, out=None) → Tensor | performs 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. |