I have experimented with some example tensors of reasonably large size, and fetching the min and max values from these tensors seems suspiciously fast. Are these operations O(n) or does Pytorch perhaps keep track of them behind the scenes for quick retrieval? Of course the time taken will be system dependent, as well as GPU dependent. The below example is running with tensors on a CPU.
import torch
import time

large_tensor = torch.randn(100,500,10000)
start = time.time()
print(large_tensor.min())
print(large_tensor.max())
end = time.time() - start 
print(f'Time taken to find both min and max: {end} seconds')

Output:
Time taken to find both min and max: 0.6569840908050537 seconds
Thank you in advance for considering my question!