Пример #1
0
 def test_copy_parent_rvs(self):
   with self.test_session() as sess:
     x = Normal(0.0, 1.0)
     y = tf.constant(3.0)
     z = x * y
     z_new = ed.copy(z, scope='no_copy_parent_rvs', copy_parent_rvs=False)
     self.assertEqual(len(ed.random_variables()), 1)
     z_new = ed.copy(z, scope='copy_parent_rvs', copy_parent_rvs=True)
     self.assertEqual(len(ed.random_variables()), 2)
Пример #2
0
 def test_copy_parent_rvs(self):
   with self.test_session() as sess:
     x = Normal(0.0, 1.0)
     y = tf.constant(3.0)
     z = x * y
     z_new = ed.copy(z, scope='no_copy_parent_rvs', copy_parent_rvs=False)
     self.assertEqual(len(ed.random_variables()), 1)
     z_new = ed.copy(z, scope='copy_parent_rvs', copy_parent_rvs=True)
     self.assertEqual(len(ed.random_variables()), 2)
def eye_color(person):
    random_variables = {x.name: x for x in ed.random_variables()}
    if person + '/' in random_variables:
        return random_variables[person + '/']
    else:
        return Categorical(probs=tf.ones(3) / 3, name=person)
Пример #4
0
def eye_color(person):
  random_variables = {x.name: x for x in ed.random_variables()}
  if person + '/' in random_variables:
    return random_variables[person + '/']
  else:
    return Categorical(probs=tf.ones(3) / 3, name=person)