Add EmptyNameScope to allow you jump out from current scope. (#14631)
authorZhiping Xiu <zhipingxiu@fb.com>
Wed, 12 Dec 2018 09:32:28 +0000 (01:32 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 12 Dec 2018 09:39:50 +0000 (01:39 -0800)
commit1423c0d9f1f1924d94868c1e2c991878b9ea15b9
tree1e3e5c4812caf602ddd424ab274c24bd93a594e0
parent479481b6cbcdccbc99c8c45da30033b77502b96b
Add EmptyNameScope to allow you jump out from current scope. (#14631)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14631

adding a empty name scope to allow people jump out from current namescope.

This could be useful when you want to access blob from parent or sibling scope.

 Facebook:

e.g: we encoutered a potential usecase in D13124249 (it's a large diff, please search by EmptyNameScope in that diff), we need to access to a blob declared in root namescope from a device namescope (device namescope has been used by parallel_GPU API). `EmptyNameScope` can help us do that with ease.

I referenced to `EmptyDeviceScope` D6103412 while implementing this one.

Reviewed By: yinghai

Differential Revision: D13272240

fbshipit-source-id: d4cde5abcc2336e456b6c6ef086266ef94d86da8
caffe2/python/scope.py
caffe2/python/scope_test.py