all AI news
empty(), empty_like() and empty_strided in PyTorch
April 8, 2024, 9:35 p.m. | Super Kai (Kazuya Ito)
DEV Community dev.to
empty() can create a 1D or more D tensor filled with the zero or more numbers in memory which is called uninitialized data.
*Memos:
- You can use torch.Tensor() or torch.FloatTensor() like torch.Tensor(3, 2, 4) or torch.FloatTensor(3, 2, 4) because they can do the same job as empty(). *torch.Tensor() is the alias of torch.FloatTensor() by default.
empty() can be used only from torch but not from a tensor
import torch
torch.empty(0)
torch.empty((0,))
# tensor([])
torch.empty(3)
torch.empty((3,))
# tensor([-1.3610e+13, 4.4916e-41, -1.3610e+13]) …
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