all AI news
tile() and repeat_interleave() in PyTorch
April 16, 2024, 3:09 a.m. | Super Kai (Kazuya Ito)
DEV Community dev.to
tile() can repeat the zero or more elements of a 0D or more D tensor as shown below:
*Memos:
tile() can be called both from torch and a tensor.- The 2nd argument is one or more dimensions(dims) with torch.
- The 1st argument or the 1st argument... is one or more dimensions(dims) with a tensor.
- If at least one dimension is 0, the returned tensor is empty.
1D tensor:
import torch
my_tensor = torch.tensor([3, 5, 1])
torch.tile(my_tensor, (0,))
my_tensor.tile((0,))
my_tensor.tile(0)
# …
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