当前位置: 首页>>代码示例>>Python>>正文


Python Normal.value方法代码示例

本文整理汇总了Python中edward.models.Normal.value方法的典型用法代码示例。如果您正苦于以下问题:Python Normal.value方法的具体用法?Python Normal.value怎么用?Python Normal.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edward.models.Normal的用法示例。


在下文中一共展示了Normal.value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_abs

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_abs(self):
   with self.test_session() as sess:
     x = Normal(0.0, 1.0)
     z = abs(x)
     z_value = abs(x.value())
     z_eval, z_value_eval = sess.run([z, z_value])
     self.assertAllEqual(z_eval, z_value_eval)
开发者ID:JoyceYa,项目名称:edward,代码行数:9,代码来源:random_variable_operators_test.py

示例2: test_neg

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_neg(self):
   with self.test_session() as sess:
     x = Normal(0.0, 1.0)
     z = -x
     z_value = -x.value()
     z_eval, z_value_eval = sess.run([z, z_value])
     self.assertAllEqual(z_eval, z_value_eval)
开发者ID:JoyceYa,项目名称:edward,代码行数:9,代码来源:random_variable_operators_test.py

示例3: test_getitem

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_getitem(self):
   with self.test_session() as sess:
     x = Normal(tf.zeros([3, 4]), tf.ones([3, 4]))
     z = x[0:2, 2:3]
     z_value = x.value()[0:2, 2:3]
     z_eval, z_value_eval = sess.run([z, z_value])
     self.assertAllEqual(z_eval, z_value_eval)
开发者ID:JoyceYa,项目名称:edward,代码行数:9,代码来源:random_variable_operators_test.py

示例4: test_rfloordiv

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_rfloordiv(self):
   with self.test_session() as sess:
     x = Normal(0.0, 1.0)
     y = 5.0
     z = y // x
     z_value = y // x.value()
     z_eval, z_value_eval = sess.run([z, z_value])
     self.assertAllEqual(z_eval, z_value_eval)
开发者ID:JoyceYa,项目名称:edward,代码行数:10,代码来源:random_variable_operators_test.py

示例5: test_div

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_div(self):
   with self.test_session() as sess:
     x = Normal(0.0, 1.0)
     y = 5.0
     z = x / y
     z_value = x.value() / y
     z_eval, z_value_eval = sess.run([z, z_value])
     self.assertAllEqual(z_eval, z_value_eval)
开发者ID:JoyceYa,项目名称:edward,代码行数:10,代码来源:random_variable_operators_test.py

示例6: test_dict_tensor_rv

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_dict_tensor_rv(self):
   with self.test_session():
     set_seed(95258)
     x = Normal(mu=0.0, sigma=0.1)
     y = tf.constant(1.0)
     z = x * y
     qx = Normal(mu=10.0, sigma=0.1)
     z_new = copy(z, {x.value(): qx})
     self.assertGreater(z_new.eval(), 5.0)
开发者ID:blei-lab,项目名称:edward,代码行数:11,代码来源:test_copy.py

示例7: test_swap_tensor_rv

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_swap_tensor_rv(self):
   with self.test_session():
     ed.set_seed(95258)
     x = Normal(0.0, 0.1)
     y = tf.constant(1.0)
     z = x * y
     qx = Normal(10.0, 0.1)
     z_new = ed.copy(z, {x.value(): qx})
     self.assertGreater(z_new.eval(), 5.0)
开发者ID:JoyceYa,项目名称:edward,代码行数:11,代码来源:copy_test.py

示例8: test_list

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_list(self):
   with self.test_session() as sess:
     x = Normal(tf.constant(0.0), tf.constant(0.1))
     y = Normal(tf.constant(10.0), tf.constant(0.1))
     cat = Categorical(logits=tf.zeros(5))
     components = [Normal(x, tf.constant(0.1))
                   for _ in range(5)]
     z = Mixture(cat=cat, components=components)
     z_new = ed.copy(z, {x: y.value()})
     self.assertGreater(z_new.value().eval(), 5.0)
开发者ID:JoyceYa,项目名称:edward,代码行数:12,代码来源:copy_test.py

示例9: test_lambda

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_lambda(self):
   x = Normal(loc=tf.zeros([100, 10, 5]), scale=tf.ones([100, 10, 5]))
   y = layers.Lambda(lambda x: x ** 2)(x.value())
开发者ID:JoyceYa,项目名称:edward,代码行数:5,代码来源:keras_core_layers_test.py

示例10: test_repeat_vector

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_repeat_vector(self):
   x = Normal(loc=tf.zeros([100, 10]), scale=tf.ones([100, 10]))
   y = layers.RepeatVector(2)(x.value())
   with self.test_session():
     self.assertEqual(y.eval().shape, (100, 2, 10))
开发者ID:JoyceYa,项目名称:edward,代码行数:7,代码来源:keras_core_layers_test.py

示例11: test_permute

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_permute(self):
   x = Normal(loc=tf.zeros([100, 10, 5]), scale=tf.ones([100, 10, 5]))
   y = layers.Permute((2, 1))(x.value())
   with self.test_session():
     self.assertEqual(y.eval().shape, (100, 5, 10))
开发者ID:JoyceYa,项目名称:edward,代码行数:7,代码来源:keras_core_layers_test.py

示例12: test_flatten

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_flatten(self):
   x = Normal(loc=tf.zeros([100, 10, 5]), scale=tf.ones([100, 10, 5]))
   y = layers.Flatten()(x.value())
   with self.test_session():
     self.assertEqual(y.eval().shape, (100, 50))
开发者ID:JoyceYa,项目名称:edward,代码行数:7,代码来源:keras_core_layers_test.py

示例13: test_dropout

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_dropout(self):
   x = Normal(loc=tf.zeros([100, 10, 5]), scale=tf.ones([100, 10, 5]))
   y = layers.Dropout(0.5)(x.value())
开发者ID:JoyceYa,项目名称:edward,代码行数:5,代码来源:keras_core_layers_test.py

示例14: test_activation

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_activation(self):
   x = Normal(loc=tf.zeros([100, 10, 5]), scale=tf.ones([100, 10, 5]))
   y = layers.Activation('tanh')(x.value())
开发者ID:JoyceYa,项目名称:edward,代码行数:5,代码来源:keras_core_layers_test.py

示例15: test_dense

# 需要导入模块: from edward.models import Normal [as 别名]
# 或者: from edward.models.Normal import value [as 别名]
 def test_dense(self):
   x = Normal(loc=tf.zeros([100, 10, 5]), scale=tf.ones([100, 10, 5]))
   y = layers.Dense(32)(x.value())
开发者ID:JoyceYa,项目名称:edward,代码行数:5,代码来源:keras_core_layers_test.py


注:本文中的edward.models.Normal.value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。