mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: To convert `nn.functional.dropout` * `_VF` had to be exposed as a Python module so this PR adds a module class to forward to `torch._C._VariableFunctions` * rng state between calls in the tests needed to be made consistent Pull Request resolved: https://github.com/pytorch/pytorch/pull/13484 Differential Revision: D12929622 Pulled By: driazati fbshipit-source-id: 78b455db9c8856b94d2dda573fb7dc74d5784f56
15 lines
310 B
Python
15 lines
310 B
Python
import torch
|
|
import sys
|
|
import types
|
|
|
|
|
|
class VFModule(types.ModuleType):
|
|
def __init__(self, name):
|
|
super(VFModule, self).__init__(name)
|
|
self.vf = torch._C._VariableFunctions
|
|
|
|
def __getattr__(self, attr):
|
|
return getattr(self.vf, attr)
|
|
|
|
sys.modules[__name__] = VFModule(__name__)
|