all AI news
Set keepdim with keepdim argument functions PyTorch
June 28, 2024, 3:32 a.m. | Super Kai (Kazuya Ito)
DEV Community dev.to
You can set keepdim with the functions which have keepdim argument as shown below:
*Memos:
- I selected some popular keepdim argument functions such as sum(),
prod()
mean(),
median(),
min(), max(),
argmin(),
argmax(),
all() and any().
keepdim(bool, optional-Default:False) can keep the dimension of the input tensor.- Sometimes, keepdim needs to be used with dim.
sum(). *My post explains sum():
import torch
my_tensor = torch.tensor([1, 2, 3, 4])
torch.sum(input=my_tensor)
torch.sum(input=my_tensor, dim=0)
# …
argmin argument false function functions input keepdim max mean median memos min popular prod pytorch set sum tensor you
More from dev.to / DEV Community
Jobs in AI, ML, Big Data
Data Scientist
@ Ford Motor Company | Chennai, Tamil Nadu, India
Systems Software Engineer, Graphics
@ Parallelz | Vancouver, British Columbia, Canada - Remote
Engineering Manager - Geo Engineering Team (F/H/X)
@ AVIV Group | Paris, France
Data Analyst
@ Microsoft | San Antonio, Texas, United States
Azure Data Engineer
@ TechVedika | Hyderabad, India
Senior Data & AI Threat Detection Researcher (Cortex)
@ Palo Alto Networks | Tel Aviv-Yafo, Israel