PyTorch details: parameters, buffers, no-grad and shapes
EasyConcept10 minREMLE
The question
Quick PyTorch round: register_parameter versus register_buffer, what no_grad does, and squeeze versus unsqueeze.
What the interviewer is looking for
- Parameters are trained and returned by parameters()
- Buffers are saved and moved with the module but not trained
- no_grad stops graph building to save memory
- Correct shape behaviour of squeeze and unsqueeze
Your answer
Saved in this browser only. Nobody else sees it.
Why this question
Written by BlogLLM in the style of a publicly reported Zhipu AI (Z.ai) question type: gradient explosion and vanishing; register_parameter versus register_buffer; no-grad; multi-node versus single-node multi-GPU.
Reported in: nowcoder.com
Practice question written by BlogLLM based on publicly reported interview formats. Not an official Zhipu AI (Z.ai) question.