remove redundant `else`s
import pyro
import torch
+from torch.autograd import Variable
from uuid import uuid4 as uuid
@@ -99,7 +100,6 @@ class Poutine(object):
"""
if self.transparent and prev_val is not None:
return prev_val
- else:
val = fn(*args, **kwargs)
return val
@@ -109,7 +109,6 @@ class Poutine(object):
"""
if self.transparent and not (prev_val is None):
return prev_val
- else:
if obs is None:
return fn(*args, **kwargs)
return obs
@@ -120,12 +119,10 @@ class Poutine(object):
"""
if self.transparent and prev_val is not None:
return prev_val
- else:
- if isinstance(data, (torch.autograd.Variable, torch.Tensor)):
+ if isinstance(data, (Variable, torch.Tensor)):
# assume vectorized observation fn
raise NotImplementedError(
"map_data for vectorized data not yet implemented.")
- else:
# note that fn should expect an index and a datum
return [fn(i, datum) for i, datum in enumerate(data)]
@@ -135,5 +132,4 @@ class Poutine(object):
"""
if self.transparent and prev_val is not None:
return prev_val
- else:
return pyro._param_store.get_param(name, *args, **kwargs)
