AINewsnow

I don't understand pytorch grad can anyone explain

x = torch.tensor(6.0, requires_grad=True) f = x ** 2 f f.backward(retain_graph=True) x.grad I am learning pytorch and I encounter this code above when i run it i got 36.0(the value of f) but after doing f.backward() and then x.grad i got 12 i don't understand why can anyone explain this to me submi…

Read the full story at r/learnmachinelearning ↗

Timeline · 1 report

  1. 2026-09-19 05:53 · r/learnmachinelearning
    I don't understand pytorch grad can anyone explain

More stories

  1. Introducing Kimi K3 on Amazon Bedrock — AWS Machine Learning Blog
  2. Introducing Amazon SageMaker HyperPod Inference Gateway — AWS Machine Learning Blog
  3. Anthropic, OpenAI, SpaceXAI, Google sued over call to ‘pace’ AI development — Politico Technology
  4. Gemini Hacked Three Companies in First Known Breakout by Google’s AI — Wall Street Journal Technology
  5. NVIDIA CEO Jensen Huang rejects ‘AI will end the world’ claim, yet cautions ‘we should go as fast as we can but...’ — Mint AI
  6. Alibaba ships Qwen3.8-Omni-Flash to watch, listen and call tools — r/LocalLLM
  7. AI hallucination of Chinese nuclear components almost led to US military attack — Ars Technica AI
  8. The new AgentCore runtime: Elastic, optimized, and consistently fast starts — AWS Machine Learning Blog

Get the daily brief of stories like this at 6:30 every morning →