<jupyter_start><jupyter_text>$\displaystyle  out = \frac{3(x+2)^2}{4}$   $\displaystyle  \frac{dout}{dx} = \frac{6(x+1)}{4}$<jupyter_code>x.grad
x = torch.randn(3, requires_grad=True)
y = x * 2
cnt = 0
while y.data.norm() < 1000:
    y = y * 2
    cnt += 1
y, cnt
gradients = torch.tensor([0.1, 1, 0.001], dtype=torch.float)
y.backward(gradients, retain_graph=True)
x, x.grad
x.requires_grad, (x ** 2).requires_grad, x.requires_grad_(requires_grad=False), x.requires_grad
with torch.no_grad():
    print((x**2).requires_grad)<jupyter_output>False
{'fraction_non_alphanumeric': 0.19047619047619047, 'fraction_numerical': 0.045787545787545784, 'mean_word_length': 5.0777777777777775, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '356597', 'license': 'MIT', 'n_tokens_mistral': 248, 'n_tokens_neox': 229, 'n_words': 41, 'path': 'Projects/pyTorch/1.2.ipynb', 'repo_name': 'Luoyayu/Machine-Learning', 'size': '546'}