WAR for self.training (#14719)
authorZachary DeVito <zdevito@fb.com>
Tue, 4 Dec 2018 04:29:51 +0000 (20:29 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 4 Dec 2018 04:32:16 +0000 (20:32 -0800)
commitbb546b2e5ba92674247ef141d2e2e1d0055f8416
treef5f8db33d4aad95469f11623c517820b76426e4b
parent9a932b8b901f03d8f9e0f10bc4fcdaff14d8638f
WAR for self.training (#14719)

Summary:
To enable self.training in script modules, this PR automatically adds a buffer called 'training' if a script method requests self.training. Assignment to self.training is overloaded to assign both to the boolean property and the tensor value.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14719

Differential Revision: D13310569

Pulled By: zdevito

fbshipit-source-id: 406387bb602f8ce5794eeff37642863c75928be5
test/test_jit.py
torch/csrc/jit/script/init.cpp
torch/jit/__init__.py