Skip to content

Commit 85a1f0e

Browse files
committed
fix __str__ for not initialized groups
1 parent c97a4de commit 85a1f0e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pymc3/variational/opvi.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,11 +1021,14 @@ def logq_norm(self):
10211021
return self.logq / self.symbolic_normalizing_constant
10221022

10231023
def __str__(self):
1024-
shp = str(self.ddim)
1025-
if self.islocal:
1026-
shp = 'None, ' + shp
1027-
elif self.batched:
1028-
shp = str(self.bdim) + shp
1024+
if self.group is None:
1025+
shp = 'undefined'
1026+
else:
1027+
shp = str(self.ddim)
1028+
if self.islocal:
1029+
shp = 'None, ' + shp
1030+
elif self.batched:
1031+
shp = str(self.bdim) + ', ' + shp
10291032
return '{cls}[{shp}]'.format(shp=shp, cls=self.__class__.__name__)
10301033

10311034
@node_property

0 commit comments

Comments
 (0)