当前位置: 首页 > 文档资料 > Edward 中文文档 >

ed.get_parents

优质
小牛编辑
131浏览
2023-12-01

Aliases:

  • ed.get_parents
  • ed.util.get_parents
get_parents(
    x,
    collection=None
)

Defined in edward/util/random_variables.py.

Get parent random variables of input.

Args:

  • x: RandomVariable or tf.Tensor. Query node to find parents of.
  • collection: list of RandomVariable. The collection of random variables to check with respect to; defaults to all random variables in the graph.

Returns:

list of RandomVariable. Parent random variables of x.

Examples

a = Normal(0.0, 1.0)
b = Normal(a, 1.0)
c = Normal(0.0, 1.0)
d = Normal(b * c, 1.0)
assert set(ed.get_parents(d)) == set([b, c])