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
Data Architect
@ University of Texas at Austin | Austin, TX
Data ETL Engineer
@ University of Texas at Austin | Austin, TX
Lead GNSS Data Scientist
@ Lurra Systems | Melbourne
Senior Machine Learning Engineer (MLOps)
@ Promaton | Remote, Europe
Risk Management - Machine Learning and Model Delivery Services, Product Associate - Senior Associate-
@ JPMorgan Chase & Co. | Wilmington, DE, United States
Senior ML Engineer (Speech/ASR)
@ ObserveAI | Bengaluru