hiframes_typed.py 文件源码

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

项目:hpat 作者: IntelLabs 项目源码 文件源码
def _handle_empty_like(self, lhs, rhs, assign, call_table):
        # B = empty_like(A) -> B = empty(len(A), dtype)
        if (rhs.op == 'call'
                and rhs.func.name in call_table
                and call_table[rhs.func.name] == ['empty_like', np]):
            in_arr= rhs.args[0]
            def f(A):
                c = len(A)
            f_block = compile_to_numba_ir(f, {}, self.typingctx, (self.typemap[in_arr.name],),
                                self.typemap, self.calltypes).blocks.popitem()[1]
            replace_arg_nodes(f_block, [in_arr])
            nodes = f_block.body[:-3]  # remove none return
            size_var = nodes[-1].target
            alloc_nodes = mk_alloc(self.typemap, self.calltypes, assign.target,
                            size_var,
                            self.typemap[in_arr.name].dtype, in_arr.scope, in_arr.loc)
            return nodes + alloc_nodes
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号