Fix random issues with some of the layers getting missing from registry.
Fix random issues with some of the layers getting missing from registry.

Summary:
It looks like for the types that are created directly through type(...)
function call, we don't store the strong references anywhere. As a result
a GC call in Python might/or might not clean up these classes depending on the
phase of the moon and other random things. This results in a fact that in some
cases simple layers as a Relu might disappear.

cat_shame

Reviewed By: xianjiec

Differential Revision: D4396289

fbshipit-source-id: ba4e9b7ef54ee43349853b0acc3d3f40c74e4d73

pietern/caffe2,xzturn/caffe2,sf-wind/caffe2,Yangqing/caffe2,bwasti/caffe2,pietern/caffe2,davinwang/caffe2,pietern/caffe2,pietern/caffe2,davinwang/caffe2,bwasti/caffe2,sf-wind/caffe2,sf-wind/caffe2,bwasti/caffe2,bwasti/caffe2,caffe2/caffe2,xzturn/caffe2,xzturn/caffe2,sf-wind/caffe2,xzturn/caffe2,sf-wind/caffe2,davinwang/caffe2,davinwang/caffe2,Yangqing/caffe2,xzturn/caffe2,Yangqing/caffe2,bwasti/caffe2,davinwang/caffe2,Yangqing/caffe2,pietern/caffe2,Yangqing/caffe2