all AI news
min(), max(), argmin() and argmax() in PyTorch
April 5, 2024, 10:35 p.m. | Super Kai (Kazuya Ito)
DEV Community dev.to
*My post explains sum() and mean().
min() can get the minimum value as shown below:
*Memos:
min() can be called both from torch and a tensor.- Setting a dimension to the 2nd argument with torch or the 1st argument with a tensor gets zero or more 1st minimum values and the indices of them.
import torch
my_tensor = torch.tensor([[5, 4, 7, 7],
[6, 5, 3, 5],
[3, 8, 9, 3]])
torch.min(my_tensor)
my_tensor.min()
# tensor(3)
torch.min(my_tensor, 0)
my_tensor.min(0)
torch.min(my_tensor, …
argmin max mean memos min pytorch sum tensor torch value values
More from dev.to / DEV Community
Jobs in AI, ML, Big Data
Software Engineer for AI Training Data (School Specific)
@ G2i Inc | Remote
Software Engineer for AI Training Data (Python)
@ G2i Inc | Remote
Software Engineer for AI Training Data (Tier 2)
@ G2i Inc | Remote
Data Engineer
@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania
Artificial Intelligence – Bioinformatic Expert
@ University of Texas Medical Branch | Galveston, TX
Lead Developer (AI)
@ Cere Network | San Francisco, US