Python Torch is a package library primarily designed for tensor computations. The package supports tensor data structures and multidimensional arrays along with machine learning models, deep learning algorithms, and neural networks. The Torch LongTensor max function is used to find the largest element from the LongTensor array.
#Find the Maximum element along with axis = 0 max_elem_0, index_0 = torch.max(array,0)
#Print the Maximum element and index of element print("The Maximum element in the tensor along axis = 0 is : ", max_elem_0, "\nIndex of element : ", index_0)
Output:
The Maximum element in the tensor along axis = 0 is : tensor([14, 16, 18]) Index of element : tensor([2, 2, 2])
In the above examples, we can see that we have been using the Torch package library functions, so it belongs to the Torch package library. The LongTensor function creates a multidimensional array, and max is the function used to find the maximum element from the multidimensional arrays. The Max function can be used along with the axis parameter to find the maximum values along a particular dimension or row/column vector.
Python LongTensor.max - 30 examples found. These are the top rated real world Python examples of torch.LongTensor.max extracted from open source projects. You can rate examples to help us improve the quality of examples.