pytorch/docs/source/notes
Michael Carilli 3b040c478a Make custom_fwd a no-op when not executed under autocast (#36171)
Summary:
Currently, a custom autograd function written with
```
torch.cuda.amp.custom_fwd(cast_inputs=dtype)
def forward(ctx, *args):
    ...
```
casts incoming floating-point CUDA tensors to `dtype` unconditionally, regardless of whether the function executes in an autocast-enabled region.  I think I had the wrong idea there.  Autocast-disabled regions should give the user control of input types.  Also, `custom_fwd(cast_inputs=dtype)`-decorated functions' behavior should align with native fp32list/fp16list functions.  C++-side casting wrappers have no effect when autocast is disabled, and  `custom_fwd`'s casting should behave the same way.

The present PR changes `custom_fwd` so it only casts in autocast-enabled regions (also updates custom_fwd to ignore fp64 inputs, like the C++ wrappers).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/36171

Differential Revision: D22179511

Pulled By: ngimel

fbshipit-source-id: 5a93d070179a43206066bce19da0a5a19ecaabbd
2020-06-23 10:23:02 -07:00
..
amp_examples.rst Make custom_fwd a no-op when not executed under autocast (#36171) 2020-06-23 10:23:02 -07:00
autograd.rst Add view_as_real, view_as_complex for complex tensors (#39099) 2020-06-22 15:15:27 -07:00
broadcasting.rst
cpu_threading_runtimes.svg
cpu_threading_torchscript_inference.rst Upgrade MKL-DNN to DNNL v1.2 (#32422) 2020-03-26 22:07:59 -07:00
cpu_threading_torchscript_inference.svg
cuda.rst Update docs about DP and DDP for CUDA (#35063) 2020-03-20 20:06:37 -07:00
ddp.rst [DDP Note] Remove refs to RoundRobin PG until we officially support it (#40380) 2020-06-22 16:19:29 -07:00
extending.rst Prevent custom Functions from creating non differentiable type that requires grad (#38326) 2020-05-21 08:30:14 -07:00
faq.rst Revert "Revert D21337640: [pytorch][PR] Split up documentation into subpages and clean up some warnings" (#37778) 2020-05-04 14:32:35 -07:00
large_scale_deployments.rst Move ThreadLocalDebugInfo to c10 (#37774) 2020-05-11 19:27:41 -07:00
multiprocessing.rst Update docs for master to remove Python 2 references (#36336) 2020-04-16 10:15:48 -07:00
randomness.rst Enhance reproducibility documentation (#33795) 2020-03-06 15:32:04 -08:00
serialization.rst Add note to serialization docs about zipfile format (#40288) 2020-06-19 13:40:08 -07:00
windows.rst Update docs for master to remove Python 2 references (#36336) 2020-04-16 10:15:48 -07:00