From cf407213f929d2beca4e82135f00738b6e234712 Mon Sep 17 00:00:00 2001 From: Adam Paszke Date: Mon, 20 Nov 2017 18:44:45 +0100 Subject: Clean up stochastic function related dead code (#3782) --- torch/autograd/variable.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'torch/autograd/variable.py') 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): -- cgit v1.2.3