pytorch/test/cpp
Luca Wehrstedt 36e47af58b Pass reference to parent future in callbacks (#57635)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57635

Note: this PR looks massive, but it's just one simple change, codemodded many times.

In many cases, a callback needs to access the value/error produced by the parent future. In Python this was easy because the callback was invoked with the parent future as argument, and could thus inspect it. In C++ the callbacks didn't take any arguments, thus in many cases we worked around this by capturing the future in its own callback. This is risky (leads to reference cycle and thus memory leak) and must be done carefully (spoiler: sometimes we weren't).
ghstack-source-id: 128296580

Test Plan: CI

Reviewed By: wanchaol

Differential Revision: D28178783

fbshipit-source-id: 6de02c4568be42123372edc008f630d5ddae0081
2021-05-07 03:59:18 -07:00
..
api Add missing return statement from 57057 (#57669) 2021-05-05 16:13:35 -07:00
common
dist_autograd Forbid trailing whitespace (#53406) 2021-03-05 17:22:55 -08:00
jit Pass reference to parent future in callbacks (#57635) 2021-05-07 03:59:18 -07:00
lite_interpreter_runtime Revert D27958477: [PyTorch][Edge] Add v4 and v5 models and remove unused model 2021-04-23 14:42:01 -07:00
rpc Pass reference to parent future in callbacks (#57635) 2021-05-07 03:59:18 -07:00
tensorexpr [NNC] Add support for computing conv with dynamic shapes (#57514) 2021-05-06 01:08:25 -07:00
__init__.py