本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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())
示例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))
示例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))
示例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))
示例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())
示例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())
示例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())