summaryrefslogtreecommitdiff
path: root/torch/autograd/variable.py
diff options
context:
space:
mode:
authorAdam Paszke <adam.paszke@gmail.com>2017-11-20 18:44:45 +0100
committerSoumith Chintala <soumith@gmail.com>2017-11-20 12:44:45 -0500
commitcf407213f929d2beca4e82135f00738b6e234712 (patch)
tree62e90ae95b87fbe0cfb2a9658a1fca004913bb35 /torch/autograd/variable.py
parent38cd6b3bd0d5b4e33693b96731edce1cfa825d62 (diff)
downloadpytorch-cf407213f929d2beca4e82135f00738b6e234712.tar.gz
pytorch-cf407213f929d2beca4e82135f00738b6e234712.tar.bz2
pytorch-cf407213f929d2beca4e82135f00738b6e234712.zip
Clean up stochastic function related dead code (#3782)
Diffstat (limited to 'torch/autograd/variable.py')
-rw-r--r--torch/autograd/variable.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/torch/autograd/variable.py b/torch/autograd/variable.py
index 256fa1a39f..d8378320db 100644
--- a/torch/autograd/variable.py
+++ b/torch/autograd/variable.py
@@ -374,10 +374,10 @@ class Variable(_C._VariableBase):
return self.expand(tensor.size())
def multinomial(self, num_samples=1, replacement=False):
- return Categorical.apply(self, num_samples, replacement)
+ return Variable(torch.multinomial(self.data, num_samples, replacement))
def bernoulli(self):
- return Bernoulli.apply(self)
+ return Variable(torch.bernoulli(self.data))
def __rsub__(self, other):
return -self + other
@@ -432,7 +432,11 @@ class Variable(_C._VariableBase):
class _torch(object):
@staticmethod
def normal(means, std=1):
- return Normal.apply(means, std)
+ if isinstance(means, Variable):
+ means = means.data
+ if isinstance(std, Variable):
+ std = std.data
+ return Variable(torch.normal(means, std))
for method in dir(Variable):