pipeline.py 文件源码

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

项目:DeepFramework 作者: issey173 项目源码 文件源码
def _construct_pipes(core_classes_map):
        """Creates all the pipes needed to connect the cores"""

        # Create the first pipe
        receiver, sender = Pipe(duplex=False)
        # The input pipe of the pipeline is the sender end (introduced the packages to the first core)
        input_pipe = sender

        for core_class in core_classes_map:
            # If no kwargs passed, initialize as empty object
            if Pipeline.KEY_KWARGS not in core_class:
                core_class[Pipeline.KEY_KWARGS] = {}
            # The input pipe of a core is the end that receives packages
            core_class[Pipeline.KEY_KWARGS]['pipe_in'] = receiver
            # Create the inter-core pipe
            receiver, sender = Pipe(duplex=False)
            # The output pipe of a core is the end that sends the result
            core_class[Pipeline.KEY_KWARGS]['pipe_out'] = sender

        # The output pipe of the pipeline is the receiver end of the last core (in order to receive its result)
        output_pipe = receiver
        return input_pipe, output_pipe
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号