{
  "schemaVersion": "1.0",
  "item": {
    "slug": "pytorch",
    "name": "PyTorch",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/ivangdavila/pytorch",
    "canonicalUrl": "https://clawhub.ai/ivangdavila/pytorch",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/pytorch",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=pytorch",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/pytorch"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/pytorch",
    "agentPageUrl": "https://openagent3.xyz/skills/pytorch/agent",
    "manifestUrl": "https://openagent3.xyz/skills/pytorch/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/pytorch/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Train vs Eval Mode",
        "body": "model.train() enables dropout, BatchNorm updates — default after init\nmodel.eval() disables dropout, uses running stats — MUST call for inference\nMode is sticky — train/eval persists until explicitly changed\nmodel.eval() doesn't disable gradients — still need torch.no_grad()"
      },
      {
        "title": "Gradient Control",
        "body": "torch.no_grad() for inference — reduces memory, speeds up computation\nloss.backward() accumulates gradients — call optimizer.zero_grad() before backward\nzero_grad() placement matters — before forward pass, not after backward\n.detach() to stop gradient flow — prevents memory leak in logging"
      },
      {
        "title": "Device Management",
        "body": "Model AND data must be on same device — model.to(device) and tensor.to(device)\n.cuda() vs .to('cuda') — both work, .to(device) more flexible\nCUDA tensors can't convert to numpy directly — .cpu().numpy() required\ntorch.device('cuda' if torch.cuda.is_available() else 'cpu') — portable code"
      },
      {
        "title": "DataLoader",
        "body": "num_workers > 0 uses multiprocessing — Windows needs if __name__ == '__main__':\npin_memory=True with CUDA — faster transfer to GPU\nWorkers don't share state — random seeds differ per worker, set in worker_init_fn\nLarge num_workers can cause memory issues — start with 2-4, increase if CPU-bound"
      },
      {
        "title": "Saving and Loading",
        "body": "torch.save(model.state_dict(), path) — recommended, saves only weights\nLoading: create model first, then model.load_state_dict(torch.load(path))\nmap_location for cross-device — torch.load(path, map_location='cpu') if saved on GPU\nSaving whole model pickles code path — breaks if code changes"
      },
      {
        "title": "In-place Operations",
        "body": "In-place ops end with _ — tensor.add_(1) vs tensor.add(1)\nIn-place on leaf variable breaks autograd — error about modified leaf\nIn-place on intermediate can corrupt gradient — avoid in computation graph\ntensor.data bypasses autograd — legacy, prefer .detach() for safety"
      },
      {
        "title": "Memory Management",
        "body": "Accumulated tensors leak memory — .detach() logged metrics\ntorch.cuda.empty_cache() releases cached memory — but doesn't fix leaks\nDelete references and call gc.collect() — before empty_cache if needed\nwith torch.no_grad(): prevents graph storage — crucial for validation loop"
      },
      {
        "title": "Common Mistakes",
        "body": "BatchNorm with batch_size=1 fails in train mode — use eval mode or track_running_stats=False\nLoss function reduction default is 'mean' — may want 'sum' for gradient accumulation\ncross_entropy expects logits — not softmax output\n.item() to get Python scalar — .numpy() or [0] deprecated/error"
      }
    ],
    "body": "Train vs Eval Mode\nmodel.train() enables dropout, BatchNorm updates — default after init\nmodel.eval() disables dropout, uses running stats — MUST call for inference\nMode is sticky — train/eval persists until explicitly changed\nmodel.eval() doesn't disable gradients — still need torch.no_grad()\nGradient Control\ntorch.no_grad() for inference — reduces memory, speeds up computation\nloss.backward() accumulates gradients — call optimizer.zero_grad() before backward\nzero_grad() placement matters — before forward pass, not after backward\n.detach() to stop gradient flow — prevents memory leak in logging\nDevice Management\nModel AND data must be on same device — model.to(device) and tensor.to(device)\n.cuda() vs .to('cuda') — both work, .to(device) more flexible\nCUDA tensors can't convert to numpy directly — .cpu().numpy() required\ntorch.device('cuda' if torch.cuda.is_available() else 'cpu') — portable code\nDataLoader\nnum_workers > 0 uses multiprocessing — Windows needs if __name__ == '__main__':\npin_memory=True with CUDA — faster transfer to GPU\nWorkers don't share state — random seeds differ per worker, set in worker_init_fn\nLarge num_workers can cause memory issues — start with 2-4, increase if CPU-bound\nSaving and Loading\ntorch.save(model.state_dict(), path) — recommended, saves only weights\nLoading: create model first, then model.load_state_dict(torch.load(path))\nmap_location for cross-device — torch.load(path, map_location='cpu') if saved on GPU\nSaving whole model pickles code path — breaks if code changes\nIn-place Operations\nIn-place ops end with _ — tensor.add_(1) vs tensor.add(1)\nIn-place on leaf variable breaks autograd — error about modified leaf\nIn-place on intermediate can corrupt gradient — avoid in computation graph\ntensor.data bypasses autograd — legacy, prefer .detach() for safety\nMemory Management\nAccumulated tensors leak memory — .detach() logged metrics\ntorch.cuda.empty_cache() releases cached memory — but doesn't fix leaks\nDelete references and call gc.collect() — before empty_cache if needed\nwith torch.no_grad(): prevents graph storage — crucial for validation loop\nCommon Mistakes\nBatchNorm with batch_size=1 fails in train mode — use eval mode or track_running_stats=False\nLoss function reduction default is 'mean' — may want 'sum' for gradient accumulation\ncross_entropy expects logits — not softmax output\n.item() to get Python scalar — .numpy() or [0] deprecated/error"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/ivangdavila/pytorch",
    "publisherUrl": "https://clawhub.ai/ivangdavila/pytorch",
    "owner": "ivangdavila",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/pytorch",
    "downloadUrl": "https://openagent3.xyz/downloads/pytorch",
    "agentUrl": "https://openagent3.xyz/skills/pytorch/agent",
    "manifestUrl": "https://openagent3.xyz/skills/pytorch/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/pytorch/agent.md"
  }
}