Skip to content

Commit

Permalink
prevent class copy of layers object
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinvtran committed Jul 4, 2016
1 parent 29a1623 commit 09bf835
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions edward/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ def _py_log_prob(self, zs):

class Variational:
"""A container for collecting distribution objects."""
def __init__(self, layers=[]):
def __init__(self, layers=None):
get_session()
self.layers = layers
if layers == []:
if layers is None:
self.layers = []
self.shape = []
self.num_vars = 0
self.num_params = 0
Expand All @@ -164,6 +164,7 @@ def __init__(self, layers=[]):
self.sample_tensor = []
self.is_multivariate = []
else:
self.layers = layers
self.shape = [layer.shape for layer in self.layers]
self.num_vars = sum([layer.num_vars for layer in self.layers])
self.num_params = sum([layer.num_params for layer in self.layers])
Expand Down

0 comments on commit 09bf835

Please sign in to comment.