compiler.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:elfi 作者: elfi-dev 项目源码 文件源码
def compile(cls, source_net, compiled_net):
        """Remove redundant nodes from the computation graph.

        Parameters
        ----------
        source_net : nx.DiGraph
        compiled_net : nx.DiGraph

        Returns
        -------
        compiled_net : nx.Digraph

        """
        logger.debug("{} compiling...".format(cls.__name__))

        outputs = compiled_net.graph['outputs']
        output_ancestors = nbunch_ancestors(compiled_net, outputs)
        for node in compiled_net.nodes():
            if node not in output_ancestors:
                compiled_net.remove_node(node)
        return compiled_net
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号