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
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
C003549 Data Analyst (NS) - MON 13 May
@ EMW, Inc. | Braine-l'Alleud, Wallonia, Belgium
Marketing Decision Scientist
@ Meta | Menlo Park, CA | New York City