neulab/docprompting-conala huggingface dataset:
torch.logical_not(input, *, out=None) → Tensor  
Computes the element-wise logical NOT of the given input tensor. If not specified, the output tensor will have the bool dtype. If the input tensor is not a bool tensor, zeros are treated as False and non-zeros are treated as True.  Parameters 
input (Tensor) – the input tensor.  Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> torch.logical_not(torch.tensor([True, False]))
tensor([False,  True])
>>> torch.logical_not(torch.tensor([0, 1, -10], dtype=torch.int8))
tensor([ True, False, False])
>>> torch.logical_not(torch.tensor([0., 1.5, -10.], dtype=torch.double))
tensor([ True, False, False])
>>> torch.logical_not(torch.tensor([0., 1., -10.], dtype=torch.double), out=torch.empty(3, dtype=torch.int16))
tensor([1, 0, 0], dtype=torch.int16)
torch.logical_or(input, other, *, out=None) → Tensor  
Computes the element-wise logical OR of the given input tensors. Zeros are treated as False and nonzeros are treated as True.  Parameters 
 
input (Tensor) – the input tensor. 
other (Tensor) – the tensor to compute OR with   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> torch.logical_or(torch.tensor([True, False, True]), torch.tensor([True, False, False]))
tensor([ True, False,  True])
>>> a = torch.tensor([0, 1, 10, 0], dtype=torch.int8)
>>> b = torch.tensor([4, 0, 1, 0], dtype=torch.int8)
>>> torch.logical_or(a, b)
tensor([ True,  True,  True, False])
>>> torch.logical_or(a.double(), b.double())
tensor([ True,  True,  True, False])
>>> torch.logical_or(a.double(), b)
tensor([ True,  True,  True, False])
>>> torch.logical_or(a, b, out=torch.empty(4, dtype=torch.bool))
tensor([ True,  True,  True, False])
torch.logical_xor(input, other, *, out=None) → Tensor  
Computes the element-wise logical XOR of the given input tensors. Zeros are treated as False and nonzeros are treated as True.  Parameters 
 
input (Tensor) – the input tensor. 
other (Tensor) – the tensor to compute XOR with   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> torch.logical_xor(torch.tensor([True, False, True]), torch.tensor([True, False, False]))
tensor([False, False,  True])
>>> a = torch.tensor([0, 1, 10, 0], dtype=torch.int8)
>>> b = torch.tensor([4, 0, 1, 0], dtype=torch.int8)
>>> torch.logical_xor(a, b)
tensor([ True,  True, False, False])
>>> torch.logical_xor(a.double(), b.double())
tensor([ True,  True, False, False])
>>> torch.logical_xor(a.double(), b)
tensor([ True,  True, False, False])
>>> torch.logical_xor(a, b, out=torch.empty(4, dtype=torch.bool))
tensor([ True,  True, False, False])
torch.logit(input, eps=None, *, out=None) → Tensor  
Returns a new tensor with the logit of the elements of input. input is clamped to [eps, 1 - eps] when eps is not None. When eps is None and input < 0 or input > 1, the function will yields NaN.  yi=ln⁡(zi1−zi)zi={xiif eps is Noneepsif xi<epsxiif eps≤xi≤1−eps1−epsif xi>1−epsy_{i} = \ln(\frac{z_{i}}{1 - z_{i}}) \\ z_{i} = \begin{cases} x_{i} & \text{if eps is None} \\ \text{eps} & \text{if } x_{i} < \text{eps} \\ x_{i} & \text{if } \text{eps} \leq x_{i} \leq 1 - \text{eps} \\ 1 - \text{eps} & \text{if } x_{i} > 1 - \text{eps} \end{cases}  
 Parameters 
 
input (Tensor) – the input tensor. 
eps (float, optional) – the epsilon for input clamp bound. Default: None
   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> a = torch.rand(5)
>>> a
tensor([0.2796, 0.9331, 0.6486, 0.1523, 0.6516])
>>> torch.logit(a, eps=1e-6)
tensor([-0.9466,  2.6352,  0.6131, -1.7169,  0.6261])
torch.logspace(start, end, steps, base=10.0, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) → Tensor  
Creates a one-dimensional tensor of size steps whose values are evenly spaced from basestart{{\text{{base}}}}^{{\text{{start}}}}  to baseend{{\text{{base}}}}^{{\text{{end}}}} , inclusive, on a logarithmic scale with base base. That is, the values are:  (basestart,base(start+end−startsteps−1),…,base(start+(steps−2)∗end−startsteps−1),baseend)(\text{base}^{\text{start}}, \text{base}^{(\text{start} + \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, \ldots, \text{base}^{(\text{start} + (\text{steps} - 2) * \frac{\text{end} - \text{start}}{ \text{steps} - 1})}, \text{base}^{\text{end}})  
 Warning Not providing a value for steps is deprecated. For backwards compatibility, not providing a value for steps will create a tensor with 100 elements. Note that this behavior is not reflected in the documented function signature and should not be relied on. In a future PyTorch release, failing to provide a value for steps will throw a runtime error.   Parameters 
 
start (float) – the starting value for the set of points 
end (float) – the ending value for the set of points 
steps (int) – size of the constructed tensor 
base (float, optional) – base of the logarithm function. Default: 10.0.   Keyword Arguments 
 
out (Tensor, optional) – the output tensor. 
dtype (torch.dtype, optional) – the desired data type of returned tensor. Default: if None, uses a global default (see torch.set_default_tensor_type()). 
layout (torch.layout, optional) – the desired layout of returned Tensor. Default: torch.strided. 
device (torch.device, optional) – the desired device of returned tensor. Default: if None, uses the current device for the default tensor type (see torch.set_default_tensor_type()). device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. 
requires_grad (bool, optional) – If autograd should record operations on the returned tensor. Default: False.    Example: >>> torch.logspace(start=-10, end=10, steps=5)
tensor([ 1.0000e-10,  1.0000e-05,  1.0000e+00,  1.0000e+05,  1.0000e+10])
>>> torch.logspace(start=0.1, end=1.0, steps=5)
tensor([  1.2589,   2.1135,   3.5481,   5.9566,  10.0000])
>>> torch.logspace(start=0.1, end=1.0, steps=1)
tensor([1.2589])
>>> torch.logspace(start=2, end=2, steps=1, base=2)
tensor([4.0])
torch.logsumexp(input, dim, keepdim=False, *, out=None)  
Returns the log of summed exponentials of each row of the input tensor in the given dimension dim. The computation is numerically stabilized. For summation index jj  given by dim and other indices ii , the result is  logsumexp(x)i=log⁡∑jexp⁡(xij)\text{logsumexp}(x)_{i} = \log \sum_j \exp(x_{ij})   If keepdim is True, the output tensor is of the same size as input except in the dimension(s) dim where it is of size 1. Otherwise, dim is squeezed (see torch.squeeze()), resulting in the output tensor having 1 (or len(dim)) fewer dimension(s).  Parameters 
 
input (Tensor) – the input tensor. 
dim (int or tuple of python:ints) – the dimension or dimensions to reduce. 
keepdim (bool) – whether the output tensor has dim retained or not.   Keyword Arguments 
out (Tensor, optional) – the output tensor.    Example::

>>> a = torch.randn(3, 3)
>>> torch.logsumexp(a, 1)
tensor([ 0.8442,  1.4322,  0.8711])
torch.lstsq(input, A, *, out=None) → Tensor  
Computes the solution to the least squares and least norm problems for a full rank matrix AA  of size (m×n)(m \times n)  and a matrix BB  of size (m×k)(m \times k) . If m≥nm \geq n , lstsq() solves the least-squares problem:  min⁡X∥AX−B∥2.\begin{array}{ll} \min_X & \|AX-B\|_2. \end{array} 
If m<nm < n , lstsq() solves the least-norm problem:  min⁡X∥X∥2subject toAX=B.\begin{array}{ll} \min_X & \|X\|_2 & \text{subject to} & AX = B. \end{array} 
Returned tensor XX  has shape (max⁡(m,n)×k)(\max(m, n) \times k) . The first nn  rows of XX  contains the solution. If m≥nm \geq n , the residual sum of squares for the solution in each column is given by the sum of squares of elements in the remaining m−nm - n  rows of that column.  Note The case when m<nm < n  is not supported on the GPU.   Parameters 
 
input (Tensor) – the matrix BB 
 
A (Tensor) – the mm  by nn  matrix AA 
   Keyword Arguments 
out (tuple, optional) – the optional destination tensor  Returns 
A namedtuple (solution, QR) containing:  
solution (Tensor): the least squares solution 
QR (Tensor): the details of the QR factorization   Return type 
(Tensor, Tensor)    Note The returned matrices will always be transposed, irrespective of the strides of the input matrices. That is, they will have stride (1, m) instead of (m, 1).  Example: >>> A = torch.tensor([[1., 1, 1],
...                   [2, 3, 4],
...                   [3, 5, 2],
...                   [4, 2, 5],
...                   [5, 4, 3]])
>>> B = torch.tensor([[-10., -3],
...                   [ 12, 14],
...                   [ 14, 12],
...                   [ 16, 16],
...                   [ 18, 16]])
>>> X, _ = torch.lstsq(B, A)
>>> X
tensor([[  2.0000,   1.0000],
        [  1.0000,   1.0000],
        [  1.0000,   2.0000],
        [ 10.9635,   4.8501],
        [  8.9332,   5.2418]])
torch.lt(input, other, *, out=None) → Tensor  
Computes input<other\text{input} < \text{other}  element-wise. The second argument can be a number or a tensor whose shape is broadcastable with the first argument.  Parameters 
 
input (Tensor) – the tensor to compare 
other (Tensor or float) – the tensor or value to compare   Keyword Arguments 
out (Tensor, optional) – the output tensor.  Returns 
A boolean tensor that is True where input is less than other and False elsewhere   Example: >>> torch.lt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]))
tensor([[False, False], [True, False]])
torch.lu(*args, **kwargs)  
Computes the LU factorization of a matrix or batches of matrices A. Returns a tuple containing the LU factorization and pivots of A. Pivoting is done if pivot is set to True.  Note The pivots returned by the function are 1-indexed. If pivot is False, then the returned pivots is a tensor filled with zeros of the appropriate size.   Note LU factorization with pivot = False is not available for CPU, and attempting to do so will throw an error. However, LU factorization with pivot = False is available for CUDA.   Note This function does not check if the factorization was successful or not if get_infos is True since the status of the factorization is present in the third element of the return tuple.   Note In the case of batches of square matrices with size less or equal to 32 on a CUDA device, the LU factorization is repeated for singular matrices due to the bug in the MAGMA library (see magma issue 13).   Note L, U, and P can be derived using torch.lu_unpack().   Warning The LU factorization does have backward support, but only for square inputs of full rank.   Parameters 
 
A (Tensor) – the tensor to factor of size (∗,m,n)(*, m, n) 
 
pivot (bool, optional) – controls whether pivoting is done. Default: True
 
get_infos (bool, optional) – if set to True, returns an info IntTensor. Default: False
 
out (tuple, optional) – optional output tuple. If get_infos is True, then the elements in the tuple are Tensor, IntTensor, and IntTensor. If get_infos is False, then the elements in the tuple are Tensor, IntTensor. Default: None
   Returns 
A tuple of tensors containing  
factorization (Tensor): the factorization of size (∗,m,n)(*, m, n) 
 
pivots (IntTensor): the pivots of size (∗,min(m,n))(*, \text{min}(m, n)) . pivots stores all the intermediate transpositions of rows. The final permutation perm could be reconstructed by applying swap(perm[i], perm[pivots[i] - 1]) for i = 0, ..., pivots.size(-1) - 1, where perm is initially the identity permutation of mm  elements (essentially this is what torch.lu_unpack() is doing). 
infos (IntTensor, optional): if get_infos is True, this is a tensor of size (∗)(*)  where non-zero values indicate whether factorization for the matrix or each minibatch has succeeded or failed   Return type 
(Tensor, IntTensor, IntTensor (optional))   Example: >>> A = torch.randn(2, 3, 3)
>>> A_LU, pivots = torch.lu(A)
>>> A_LU
tensor([[[ 1.3506,  2.5558, -0.0816],
         [ 0.1684,  1.1551,  0.1940],
         [ 0.1193,  0.6189, -0.5497]],

        [[ 0.4526,  1.2526, -0.3285],
         [-0.7988,  0.7175, -0.9701],
         [ 0.2634, -0.9255, -0.3459]]])
>>> pivots
tensor([[ 3,  3,  3],
        [ 3,  3,  3]], dtype=torch.int32)
>>> A_LU, pivots, info = torch.lu(A, get_infos=True)
>>> if info.nonzero().size(0) == 0:
...   print('LU factorization succeeded for all samples!')
LU factorization succeeded for all samples!
torch.lu_solve(b, LU_data, LU_pivots, *, out=None) → Tensor  
Returns the LU solve of the linear system Ax=bAx = b  using the partially pivoted LU factorization of A from torch.lu(). This function supports float, double, cfloat and cdouble dtypes for input.  Parameters 
 
b (Tensor) – the RHS tensor of size (∗,m,k)(*, m, k) , where ∗*  is zero or more batch dimensions. 
LU_data (Tensor) – the pivoted LU factorization of A from torch.lu() of size (∗,m,m)(*, m, m) , where ∗*  is zero or more batch dimensions. 
LU_pivots (IntTensor) – the pivots of the LU factorization from torch.lu() of size (∗,m)(*, m) , where ∗*  is zero or more batch dimensions. The batch dimensions of LU_pivots must be equal to the batch dimensions of LU_data.   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> A = torch.randn(2, 3, 3)
>>> b = torch.randn(2, 3, 1)
>>> A_LU = torch.lu(A)
>>> x = torch.lu_solve(b, *A_LU)
>>> torch.norm(torch.bmm(A, x) - b)
tensor(1.00000e-07 *
       2.8312)
torch.lu_unpack(LU_data, LU_pivots, unpack_data=True, unpack_pivots=True) [source]
 
Unpacks the data and pivots from a LU factorization of a tensor. Returns a tuple of tensors as (the pivots, the L tensor, the U tensor).  Parameters 
 
LU_data (Tensor) – the packed LU factorization data 
LU_pivots (Tensor) – the packed LU factorization pivots 
unpack_data (bool) – flag indicating if the data should be unpacked 
unpack_pivots (bool) – flag indicating if the pivots should be unpacked    Examples: >>> A = torch.randn(2, 3, 3)
>>> A_LU, pivots = A.lu()
>>> P, A_L, A_U = torch.lu_unpack(A_LU, pivots)
>>>
>>> # can recover A from factorization
>>> A_ = torch.bmm(P, torch.bmm(A_L, A_U))

>>> # LU factorization of a rectangular matrix:
>>> A = torch.randn(2, 3, 2)
>>> A_LU, pivots = A.lu()
>>> P, A_L, A_U = torch.lu_unpack(A_LU, pivots)
>>> P
tensor([[[1., 0., 0.],
         [0., 1., 0.],
         [0., 0., 1.]],

        [[0., 0., 1.],
         [0., 1., 0.],
         [1., 0., 0.]]])
>>> A_L
tensor([[[ 1.0000,  0.0000],
         [ 0.4763,  1.0000],
         [ 0.3683,  0.1135]],

        [[ 1.0000,  0.0000],
         [ 0.2957,  1.0000],
         [-0.9668, -0.3335]]])
>>> A_U
tensor([[[ 2.1962,  1.0881],
         [ 0.0000, -0.8681]],

        [[-1.0947,  0.3736],
         [ 0.0000,  0.5718]]])
>>> A_ = torch.bmm(P, torch.bmm(A_L, A_U))
>>> torch.norm(A_ - A)
tensor(2.9802e-08)
torch.manual_seed(seed) [source]
 
Sets the seed for generating random numbers. Returns a torch.Generator object.  Parameters 
seed (int) – The desired seed. Value must be within the inclusive range [-0x8000_0000_0000_0000, 0xffff_ffff_ffff_ffff]. Otherwise, a RuntimeError is raised. Negative inputs are remapped to positive values with the formula 0xffff_ffff_ffff_ffff + seed.
torch.masked_select(input, mask, *, out=None) → Tensor  
Returns a new 1-D tensor which indexes the input tensor according to the boolean mask mask which is a BoolTensor. The shapes of the mask tensor and the input tensor don’t need to match, but they must be broadcastable.  Note The returned tensor does not use the same storage as the original tensor   Parameters 
 
input (Tensor) – the input tensor. 
mask (BoolTensor) – the tensor containing the binary mask to index with   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> x = torch.randn(3, 4)
>>> x
tensor([[ 0.3552, -2.3825, -0.8297,  0.3477],
        [-1.2035,  1.2252,  0.5002,  0.6248],
        [ 0.1307, -2.0608,  0.1244,  2.0139]])
>>> mask = x.ge(0.5)
>>> mask
tensor([[False, False, False, False],
        [False, True, True, True],
        [False, False, False, True]])
>>> torch.masked_select(x, mask)
tensor([ 1.2252,  0.5002,  0.6248,  2.0139])
torch.matmul(input, other, *, out=None) → Tensor  
Matrix product of two tensors. The behavior depends on the dimensionality of the tensors as follows:  If both tensors are 1-dimensional, the dot product (scalar) is returned. If both arguments are 2-dimensional, the matrix-matrix product is returned. If the first argument is 1-dimensional and the second argument is 2-dimensional, a 1 is prepended to its dimension for the purpose of the matrix multiply. After the matrix multiply, the prepended dimension is removed. If the first argument is 2-dimensional and the second argument is 1-dimensional, the matrix-vector product is returned. 
If both arguments are at least 1-dimensional and at least one argument is N-dimensional (where N > 2), then a batched matrix multiply is returned. If the first argument is 1-dimensional, a 1 is prepended to its dimension for the purpose of the batched matrix multiply and removed after. If the second argument is 1-dimensional, a 1 is appended to its dimension for the purpose of the batched matrix multiple and removed after. The non-matrix (i.e. batch) dimensions are broadcasted (and thus must be broadcastable). For example, if input is a (j×1×n×n)(j \times 1 \times n \times n)  tensor and other is a (k×n×n)(k \times n \times n)  tensor, out will be a (j×k×n×n)(j \times k \times n \times n)  tensor. Note that the broadcasting logic only looks at the batch dimensions when determining if the inputs are broadcastable, and not the matrix dimensions. For example, if input is a (j×1×n×m)(j \times 1 \times n \times m)  tensor and other is a (k×m×p)(k \times m \times p)  tensor, these inputs are valid for broadcasting even though the final two dimensions (i.e. the matrix dimensions) are different. out will be a (j×k×n×p)(j \times k \times n \times p)  tensor.   This operator supports TensorFloat32.  Note The 1-dimensional dot product version of this function does not support an out parameter.   Parameters 
 
input (Tensor) – the first tensor to be multiplied 
other (Tensor) – the second tensor to be multiplied   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> # vector x vector
>>> tensor1 = torch.randn(3)
>>> tensor2 = torch.randn(3)
>>> torch.matmul(tensor1, tensor2).size()
torch.Size([])
>>> # matrix x vector
>>> tensor1 = torch.randn(3, 4)
>>> tensor2 = torch.randn(4)
>>> torch.matmul(tensor1, tensor2).size()
torch.Size([3])
>>> # batched matrix x broadcasted vector
>>> tensor1 = torch.randn(10, 3, 4)
>>> tensor2 = torch.randn(4)
>>> torch.matmul(tensor1, tensor2).size()
torch.Size([10, 3])
>>> # batched matrix x batched matrix
>>> tensor1 = torch.randn(10, 3, 4)
>>> tensor2 = torch.randn(10, 4, 5)
>>> torch.matmul(tensor1, tensor2).size()
torch.Size([10, 3, 5])
>>> # batched matrix x broadcasted matrix
>>> tensor1 = torch.randn(10, 3, 4)
>>> tensor2 = torch.randn(4, 5)
>>> torch.matmul(tensor1, tensor2).size()
torch.Size([10, 3, 5])
torch.matrix_exp()  
Returns the matrix exponential. Supports batched input. For a matrix A, the matrix exponential is defined as  eA=∑k=0∞Ak/k!\mathrm{e}^A = \sum_{k=0}^\infty A^k / k!  
The implementation is based on: Bader, P.; Blanes, S.; Casas, F. Computing the Matrix Exponential with an Optimized Taylor Polynomial Approximation. Mathematics 2019, 7, 1174.  Parameters 
input (Tensor) – the input tensor.   Example: >>> a = torch.randn(2, 2, 2)
>>> a[0, :, :] = torch.eye(2, 2)
>>> a[1, :, :] = 2 * torch.eye(2, 2)
>>> a
tensor([[[1., 0.],
         [0., 1.]],

        [[2., 0.],
         [0., 2.]]])
>>> torch.matrix_exp(a)
tensor([[[2.7183, 0.0000],
         [0.0000, 2.7183]],

         [[7.3891, 0.0000],
          [0.0000, 7.3891]]])

>>> import math
>>> x = torch.tensor([[0, math.pi/3], [-math.pi/3, 0]])
>>> x.matrix_exp() # should be [[cos(pi/3), sin(pi/3)], [-sin(pi/3), cos(pi/3)]]
tensor([[ 0.5000,  0.8660],
        [-0.8660,  0.5000]])
torch.matrix_power(input, n) → Tensor  
Returns the matrix raised to the power n for square matrices. For batch of matrices, each individual matrix is raised to the power n. If n is negative, then the inverse of the matrix (if invertible) is raised to the power n. For a batch of matrices, the batched inverse (if invertible) is raised to the power n. If n is 0, then an identity matrix is returned.  Parameters 
 
input (Tensor) – the input tensor. 
n (int) – the power to raise the matrix to    Example: >>> a = torch.randn(2, 2, 2)
>>> a
tensor([[[-1.9975, -1.9610],
         [ 0.9592, -2.3364]],

        [[-1.2534, -1.3429],
         [ 0.4153, -1.4664]]])
>>> torch.matrix_power(a, 3)
tensor([[[  3.9392, -23.9916],
         [ 11.7357,  -0.2070]],

        [[  0.2468,  -6.7168],
         [  2.0774,  -0.8187]]])
torch.matrix_rank(input, tol=None, symmetric=False, *, out=None) → Tensor  
Returns the numerical rank of a 2-D tensor. The method to compute the matrix rank is done using SVD by default. If symmetric is True, then input is assumed to be symmetric, and the computation of the rank is done by obtaining the eigenvalues. tol is the threshold below which the singular values (or the eigenvalues when symmetric is True) are considered to be 0. If tol is not specified, tol is set to S.max() * max(S.size()) * eps where S is the singular values (or the eigenvalues when symmetric is True), and eps is the epsilon value for the datatype of input.  Note torch.matrix_rank() is deprecated. Please use torch.linalg.matrix_rank() instead. The parameter symmetric was renamed in torch.linalg.matrix_rank() to hermitian.   Parameters 
 
input (Tensor) – the input 2-D tensor 
tol (float, optional) – the tolerance value. Default: None
 
symmetric (bool, optional) – indicates whether input is symmetric. Default: False
   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> a = torch.eye(10)
>>> torch.matrix_rank(a)
tensor(10)
>>> b = torch.eye(10)
>>> b[0, 0] = 0
>>> torch.matrix_rank(b)
tensor(9)
torch.max(input) → Tensor  
Returns the maximum value of all elements in the input tensor.  Warning This function produces deterministic (sub)gradients unlike max(dim=0)   Parameters 
input (Tensor) – the input tensor.   Example: >>> a = torch.randn(1, 3)
>>> a
tensor([[ 0.6763,  0.7445, -2.2369]])
>>> torch.max(a)
tensor(0.7445)
  
torch.max(input, dim, keepdim=False, *, out=None) -> (Tensor, LongTensor) 
 Returns a namedtuple (values, indices) where values is the maximum value of each row of the input tensor in the given dimension dim. And indices is the index location of each maximum value found (argmax). If keepdim is True, the output tensors are of the same size as input except in the dimension dim where they are of size 1. Otherwise, dim is squeezed (see torch.squeeze()), resulting in the output tensors having 1 fewer dimension than input.  Note If there are multiple maximal values in a reduced row then the indices of the first maximal value are returned.   Parameters 
 
input (Tensor) – the input tensor. 
dim (int) – the dimension to reduce. 
keepdim (bool) – whether the output tensor has dim retained or not. Default: False.   Keyword Arguments 
out (tuple, optional) – the result tuple of two output tensors (max, max_indices)   Example: >>> a = torch.randn(4, 4)
>>> a
tensor([[-1.2360, -0.2942, -0.1222,  0.8475],
        [ 1.1949, -1.1127, -2.2379, -0.6702],
        [ 1.5717, -0.9207,  0.1297, -1.8768],
        [-0.6172,  1.0036, -0.6060, -0.2432]])
>>> torch.max(a, 1)
torch.return_types.max(values=tensor([0.8475, 1.1949, 1.5717, 1.0036]), indices=tensor([3, 0, 0, 1]))
  
torch.max(input, other, *, out=None) → Tensor 
 See torch.maximum().
torch.maximum(input, other, *, out=None) → Tensor  
Computes the element-wise maximum of input and other.  Note If one of the elements being compared is a NaN, then that element is returned. maximum() is not supported for tensors with complex dtypes.   Parameters 
 
input (Tensor) – the input tensor. 
other (Tensor) – the second input tensor   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> a = torch.tensor((1, 2, -1))
>>> b = torch.tensor((3, 0, 4))
>>> torch.maximum(a, b)
tensor([3, 2, 4])