Add Uint Support
pytorch/pytorch
Add unsigned integer (uint) type support to PyTorch operators by updating ATDISPATCH macros.
Avoid common PyTorch mistakes and apply robust training patterns
$ npx skills add wentorai/research-plugins --skill pytorch-guide -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install wentorai/research-plugins pytorch-guide --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/wentorai/research-plugins.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/domains/ai-ml/pytorch-guide .claude/skills/pytorch-guide && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "pytorch-guide" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/ai-ml/pytorch-guide into .claude/skills/pytorch-guide/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-guide", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/wentorai/research-plugins/tree/main/skills/domains/ai-ml/pytorch-guideType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add wentorai/research-plugins --skill pytorch-guide -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install wentorai/research-plugins pytorch-guide --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/wentorai/research-plugins.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/domains/ai-ml/pytorch-guide .agents/skills/pytorch-guide && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "pytorch-guide" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/ai-ml/pytorch-guide into .agents/skills/pytorch-guide/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-guide", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add wentorai/research-plugins --skill pytorch-guide -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install wentorai/research-plugins pytorch-guide --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/wentorai/research-plugins.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/domains/ai-ml/pytorch-guide .cursor/skills/pytorch-guide && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "pytorch-guide" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/ai-ml/pytorch-guide into .cursor/skills/pytorch-guide/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-guide", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/wentorai/research-plugins.git --path skills/domains/ai-ml/pytorch-guide--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add wentorai/research-plugins --skill pytorch-guide -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install wentorai/research-plugins pytorch-guide --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/wentorai/research-plugins.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/domains/ai-ml/pytorch-guide .gemini/skills/pytorch-guide && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "pytorch-guide" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/ai-ml/pytorch-guide into .gemini/skills/pytorch-guide/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-guide", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install wentorai/research-plugins pytorch-guideInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add wentorai/research-plugins --skill pytorch-guide -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/wentorai/research-plugins.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/domains/ai-ml/pytorch-guide .github/skills/pytorch-guide && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "pytorch-guide" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/ai-ml/pytorch-guide into .github/skills/pytorch-guide/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-guide", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add wentorai/research-plugins --skill pytorch-guide -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install wentorai/research-plugins pytorch-guide --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/wentorai/research-plugins.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/domains/ai-ml/pytorch-guide .opencode/skills/pytorch-guide && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "pytorch-guide" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/ai-ml/pytorch-guide into .opencode/skills/pytorch-guide/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pytorch-guide", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
pytorch-guideAvoid common PyTorch mistakes and apply robust training patterns
Pytorch Guide is an agent skill from wentorai/research-plugins. Avoid common PyTorch mistakes and apply robust training patterns
Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in AI & LLM Engineering, covering Deep learning. It works with PyTorch. The repository describes itself as: 350+ academic research skills, MCP configs, and plugins for Research-Claw and AI agents. The licence is MIT.
Read from SKILL.md and the folder at commit bf44b3c. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are python).
From the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
pytorch.orggithub.comlightning.aiFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Pytorch Guide loads about 2.4k tokens when it runs. Until then it costs about 20 tokens; SKILL.md has 321 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from wentorai/research-plugins at commit bf44b3c, republished under its MIT licence (© wentorai). 321 words, ~2,386 tokens.
.claude/skills/pytorch-guide/SKILL.md (or your agent's skills folder).PyTorch is the dominant deep learning framework in academic research, used in the majority of papers at NeurIPS, ICML, and ICLR. Its eager execution model, Pythonic API, and seamless integration with the Python scientific stack make it the default choice for prototyping and publishing research code.
However, PyTorch's flexibility is a double-edged sword. Subtle bugs -- forgetting model.eval(), accumulating gradients across batches, incorrect device placement, memory leaks from detached tensors -- can silently corrupt results without raising errors. These issues are especially dangerous in research settings where ground truth is unknown.
This guide catalogs the most common PyTorch mistakes, provides battle-tested training patterns, and covers performance optimization techniques that every researcher should know. The patterns here are drawn from top-tier ML research codebases and the PyTorch team's own best practice recommendations.
# MISTAKE 1: Forgetting model.eval() and torch.no_grad()
# This causes dropout and batch norm to behave incorrectly during evaluation
# and wastes memory by tracking gradients
# WRONG
def evaluate(model, dataloader):
total_correct = 0
for x, y in dataloader:
output = model(x) # Dropout still active! BN using batch stats!
total_correct += (output.argmax(1) == y).sum().item()
# RIGHT
@torch.no_grad()
def evaluate(model, dataloader):
model.eval()
total_correct = 0
for x, y in dataloader:
output = model(x)
total_correct += (output.argmax(1) == y).sum().item()
model.train() # Restore training mode
return total_correct# MISTAKE 2: Not zeroing gradients (they accumulate by default!)
# WRONG - gradients from previous batch add to current batch
for x, y in dataloader:
loss = criterion(model(x), y)
loss.backward()
optimizer.step()
# RIGHT
for x, y in dataloader:
optimizer.zero_grad() # Clear previous gradients
loss = criterion(model(x), y)
loss.backward()
optimizer.step()
# BETTER (slightly faster, avoids memset)
for x, y in dataloader:
optimizer.zero_grad(set_to_none=True)
loss = criterion(model(x), y)
loss.backward()
optimizer.step()# MISTAKE 3: Memory leaks from tensor operations in metrics
# WRONG - keeps entire computation graph in memory
losses = []
for x, y in dataloader:
loss = criterion(model(x), y)
losses.append(loss) # Retains computation graph!
# RIGHT - detach from graph and move to CPU
losses = []
for x, y in dataloader:
loss = criterion(model(x), y)
losses.append(loss.item()) # .item() extracts Python scalar# MISTAKE 4: Incorrect device placement
# WRONG - model on GPU, data on CPU
model = model.cuda()
for x, y in dataloader:
output = model(x) # RuntimeError: tensors on different devices
# RIGHT
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = model.to(device)
for x, y in dataloader:
x, y = x.to(device), y.to(device)
output = model(x)# MISTAKE 5: Mutable default arguments in dataset transforms
# WRONG
class MyDataset(Dataset):
def __init__(self, data, transforms=[]): # Shared mutable list!
self.transforms = transforms
# RIGHT
class MyDataset(Dataset):
def __init__(self, data, transforms=None):
self.transforms = transforms or []import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.cuda.amp import autocast, GradScaler
import time
def train(
model: nn.Module,
train_loader: DataLoader,
val_loader: DataLoader,
optimizer: torch.optim.Optimizer,
scheduler,
num_epochs: int,
device: torch.device,
use_amp: bool = True,
):
"""Production-quality training loop with mixed precision and checkpointing."""
criterion = nn.CrossEntropyLoss()
scaler = GradScaler(enabled=use_amp)
best_val_loss = float("inf")
for epoch in range(num_epochs):
# --- Training ---
model.train()
train_loss = 0.0
t0 = time.time()
for batch_idx, (x, y) in enumerate(train_loader):
x, y = x.to(device, non_blocking=True), y.to(device, non_blocking=True)
optimizer.zero_grad(set_to_none=True)
with autocast(enabled=use_amp):
output = model(x)
loss = criterion(output, y)
scaler.scale(loss).backward()
scaler.unscale_(optimizer)
torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)
scaler.step(optimizer)
scaler.update()
train_loss += loss.item()
scheduler.step()
avg_train_loss = train_loss / len(train_loader)
# --- Validation ---
model.eval()
val_loss = 0.0
correct = 0
total = 0
with torch.no_grad():
for x, y in val_loader:
x, y = x.to(device, non_blocking=True), y.to(device, non_blocking=True)
with autocast(enabled=use_amp):
output = model(x)
loss = criterion(output, y)
val_loss += loss.item()
correct += (output.argmax(1) == y).sum().item()
total += y.size(0)
avg_val_loss = val_loss / len(val_loader)
val_acc = correct / total
# --- Checkpoint ---
if avg_val_loss < best_val_loss:
best_val_loss = avg_val_loss
torch.save({
"epoch": epoch,
"model_state_dict": model.state_dict(),
"optimizer_state_dict": optimizer.state_dict(),
"val_loss": avg_val_loss,
}, "best_checkpoint.pt")
elapsed = time.time() - t0
print(f"Epoch {epoch+1}/{num_epochs} | "
f"Train Loss: {avg_train_loss:.4f} | "
f"Val Loss: {avg_val_loss:.4f} | "
f"Val Acc: {val_acc:.4f} | "
f"Time: {elapsed:.1f}s")| Technique | Speedup | Effort | When to Use |
|---|---|---|---|
| Mixed precision (AMP) | 1.5-3x | Low | Always on modern GPUs |
torch.compile() | 1.2-2x | Low | PyTorch 2.0+, stable models |
pin_memory=True in DataLoader | 1.1-1.3x | Trivial | Always with GPU training |
non_blocking=True in .to() | 1.05-1.1x | Trivial | Always with pinned memory |
| Gradient accumulation | N/A | Low | When batch size limited by memory |
torch.backends.cudnn.benchmark = True | 1.1-1.5x | Trivial | Fixed input sizes |
| Distributed Data Parallel | Near-linear | Medium | Multi-GPU training |
# Check GPU memory usage
print(f"Allocated: {torch.cuda.memory_allocated() / 1e9:.2f} GB")
print(f"Cached: {torch.cuda.memory_reserved() / 1e9:.2f} GB")
# Force garbage collection when debugging OOM
torch.cuda.empty_cache()
import gc; gc.collect()
# Gradient accumulation for effective large batch sizes
accumulation_steps = 4
for i, (x, y) in enumerate(dataloader):
loss = criterion(model(x.to(device)), y.to(device)) / accumulation_steps
loss.backward()
if (i + 1) % accumulation_steps == 0:
optimizer.step()
optimizer.zero_grad(set_to_none=True)import torch
import numpy as np
import random
def seed_everything(seed=42):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
# For DataLoader workers
def seed_worker(worker_id):
worker_seed = seed + worker_id
np.random.seed(worker_seed)
random.seed(worker_seed)
return seed_worker
seed_worker = seed_everything(42)
dataloader = DataLoader(
dataset, batch_size=32, shuffle=True,
worker_init_fn=seed_worker,
generator=torch.Generator().manual_seed(42),
)torch.no_grad() for inference. It reduces memory usage by ~50%.model.to(device) over .cuda(). It is device-agnostic and works on CPU, CUDA, and MPS.torch.compile(model) on PyTorch 2.0+ for free speedups on stable architectures.torch.profiler to find actual bottlenecks.requirements.txt. Different versions can produce different numerical results.torchinfo for model summary instead of printing the model object.© wentorai, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/domains/ai-ml/pytorch-guide of wentorai/research-plugins.
Open the folder on GitHubat commit bf44b3c
We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in wentorai/research-plugins, which our catalogue first saw on October 7, 2026.
Pytorch Guide next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Pytorch Guide this skillwentorai/research-plugins | 298 | 1 repos | ~2.4k | Automated safety check: Pass | MIT | |
| Add Uint Supportpytorch/pytorch | 104k | 2 repos | ~2.3k | Automated safety check: Pass | Custom licence | |
| CLIP Image-Text MatchingOrchestra-Research/AI-Research-SKILLs | 13k | 8 repos | ~1.7k | Automated safety check: Pass | MIT | |
| Add Torch Shapes Examplefacebook/pyrefly | 7.1k | — | ~1.3k | Automated safety check: Pass | MIT | |
| Interview Cheatsheetwanshuiyin/ARIS-in-AI-Offer | 580 | 1 repos | ~3.4k | Automated safety check: Notes | MIT | |
| Ghstack CIpytorch/pytorch | 104k | — | ~1.4k | Automated safety check: Pass | Custom licence |
pytorch/pytorch
Add unsigned integer (uint) type support to PyTorch operators by updating ATDISPATCH macros.
Orchestra-Research/AI-Research-SKILLs
Explains OpenAI's CLIP model for zero-shot image classification, image-text similarity, semantic image search and content moderation, with install steps and code patterns.
facebook/pyrefly
A skill your agent uses when adding a new PyTorch model to Pyrefly's shape-tracking example corpus under tensor-shapes/pyrefly-torch-stubs/examples — i.e.
wanshuiyin/ARIS-in-AI-Offer
Generate a long-form Chinese interview-prep cheat sheet on a specific ML/LLM topic — formulas with derivations, from-scratch PyTorch code, comparison tables, and 25 高频面试题 (L1 必会 / L2 进阶 / L3 顶级 lab).
pytorch/pytorch
Manage CI for PyTorch ghstack stacks by running CI where its results are useful now and deferring other PRs with [no-ci].
open-infra-skills/infra-skills
Profiles, benchmarks and tunes AI training workloads on Moore Threads MUSA GPUs with a measurement-first process that keeps model behavior unchanged.
wentorai/research-plugins
Craft structured research abstracts that maximize clarity and journal acceptance
wentorai/research-plugins
Manage academic citations across BibTeX, APA, MLA, and Chicago formats
wentorai/research-plugins
Summarize academic papers with structured extraction of key elements
wentorai/research-plugins
Evidence-based study techniques for academic learning and retention
wentorai/research-plugins
Adjust writing tone and register for academic audiences and venues
wentorai/research-plugins
Academic translation, post-editing, and Chinglish correction guide
Works with
Categories
Avoid common PyTorch mistakes and apply robust training patterns. Pytorch Guide is an agent skill from wentorai/research-plugins.
Pytorch Guide fits situations like: tasks that involve Deep learning.
Run `npx skills add wentorai/research-plugins --skill pytorch-guide -a claude-code`. Or copy the skill folder (skills/domains/ai-ml/pytorch-guide in wentorai/research-plugins) into .claude/skills/pytorch-guide in your project. Claude Code loads it when a task matches its description.
Run `npx skills add wentorai/research-plugins --skill pytorch-guide -a codex`. Or copy the skill folder (skills/domains/ai-ml/pytorch-guide in wentorai/research-plugins) into .agents/skills/pytorch-guide in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add wentorai/research-plugins --skill pytorch-guide -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pytorch-guide, .gemini/skills/pytorch-guide, .github/skills/pytorch-guide and .opencode/skills/pytorch-guide in your project.
SKILL.md names no scripts, command-line tools or credentials: Pytorch Guide is instructions for the agent only. Our summary lists: Python 3.
SKILL.md names 3 domains. As links in the text: pytorch.org, github.com and lightning.ai. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Pytorch Guide is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.4k tokens (SKILL.md is roughly 9.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Pytorch Guide: Add Uint Support (pytorch/pytorch, 104k stars), CLIP Image-Text Matching (Orchestra-Research/AI-Research-SKILLs, 13k stars), Add Torch Shapes Example (facebook/pyrefly, 7.1k stars) and Interview Cheatsheet (wanshuiyin/ARIS-in-AI-Offer, 580 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
wentorai (a GitHub user) maintains it in wentorai/research-plugins, which has 298 GitHub stars. The repository holds 405 skills in this directory. The repository was last updated on June 19, 2026.
Source: wentorai/research-plugins on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.