pytorch/docs/source/notes
Richard Barnes 9c185b6b46 [codemod] Replace hasattr with getattr in caffe2/docs/source/notes/extending.rst (#100598)
Summary:
The pattern
```
X.Y if hasattr(X, "Y") else Z
```
can be replaced with
```
getattr(X, "Y", Z)
```

The [getattr](https://www.w3schools.com/python/ref_func_getattr.asp) function gives more succinct code than the [hasattr](https://www.w3schools.com/python/ref_func_hasattr.asp) function. Please use it when appropriate.

**This diff is very low risk. Green tests indicate that you can safely Accept & Ship.**

Test Plan: Sandcastle

Differential Revision: D44886464

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100598
Approved by: https://github.com/Skylion007
2023-05-04 16:36:15 +00:00
..
amp_examples.rst
autograd.rst Fix typo under docs directory (#97202) 2023-03-21 01:24:10 +00:00
broadcasting.rst
cpu_threading_runtimes.svg
cpu_threading_torchscript_inference.rst
cpu_threading_torchscript_inference.svg
cuda.rst Add device_idx to free_fn in CUDAPluggableAllocator (#91398) 2023-01-12 05:03:48 +00:00
ddp.rst Fix typo under docs directory (#91871) 2023-01-10 22:33:36 +00:00
extending.func.rst Clarify the saving of intermediates in the "extending torch.func" docs (#98020) 2023-03-31 13:57:37 +00:00
extending.rst [codemod] Replace hasattr with getattr in caffe2/docs/source/notes/extending.rst (#100598) 2023-05-04 16:36:15 +00:00
faq.rst
gradcheck.rst
hip.rst Tweak formatting of note on macros (#89598) 2022-11-28 20:42:30 +00:00
large_scale_deployments.rst
modules.rst Replace master with main in links and docs/conf.py (#100176) 2023-05-02 18:20:32 +00:00
mps.rst
multiprocessing.rst
numerical_accuracy.rst [cuBLAS] Add an option to disable reduced precision reductions for BF16 GEMM (#89172) 2022-12-21 18:58:28 +00:00
randomness.rst
serialization.rst Replace master with main in links and docs/conf.py (#100176) 2023-05-02 18:20:32 +00:00
windows.rst