Skip to content

Commit

Permalink
Have TensorFlow Distributions share name scopes across method calls.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 193428925
  • Loading branch information
dustinvtran authored and Copybara-Service committed Apr 18, 2018
1 parent 34230a6 commit fd122fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tensorflow_probability/python/edward2/random_variable_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,18 @@ def testStr(self):
if tfe.in_eager_mode():
pattern = "RandomVariable(\"1.234\", shape=(), dtype=float32"
else:
pattern = "RandomVariable(\"Normal\", shape=(), dtype=float32"
pattern = "RandomVariable(\"Normal/\", shape=(), dtype=float32"
regexp = re.escape(pattern)
self.assertRegexpMatches(str(x), regexp)

@tfe.run_test_in_graph_and_eager_modes()
def testRepr(self):
x = ed.RandomVariable(tfd.Normal(0.0, 1.0), value=1.234)
if tfe.in_eager_mode():
string = ("<ed.RandomVariable 'Normal' shape=() dtype=float32 "
"numpy=1.234>")
string = ("<ed.RandomVariable 'Normal/' shape=() "
"dtype=float32 numpy=1.234>")
else:
string = "<ed.RandomVariable 'Normal' shape=() dtype=float32>"
string = "<ed.RandomVariable 'Normal/' shape=() dtype=float32>"
self.assertEqual(repr(x), string)

@tfe.run_test_in_graph_and_eager_modes()
Expand Down

0 comments on commit fd122fa

Please sign in to comment.