all AI news
mean() and median() in PyTorch
April 13, 2024, 10:45 p.m. | Super Kai (Kazuya Ito)
DEV Community dev.to
mean() can get the mean(average) values as shown below:
*Memos:
mean() can be called both from torch and a tensor.- The 2nd argument is one or more dimensions with torch.
- The 1st argument is one or more dimensions with a tensor.
mean() can only accept floating-point or complex numbers so you need conversion to them if they are not as I explain it in my answer(17.1) otherwise there is the error.
import torch
my_tensor = torch.tensor([[5, 4, 7, 7], …
conversion dimensions function mean median memos numbers pytorch tensor them torch 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