Empty tensor to alloc tensor
empty_tensor_to_alloc_tensor
¶
EmptyTensorLoweringPattern
¶
Bases: RewritePattern
Source code in xdsl/transforms/empty_tensor_to_alloc_tensor.py
match_and_rewrite(op: tensor.EmptyOp, rewriter: PatternRewriter)
¶
EmptyTensorToAllocTensorPass
dataclass
¶
Bases: ModulePass
tensor.empty ops return a tensor of unspecified contents whose only purpose is to carry the tensor shape. This pass converts such ops to bufferization.alloc_tensor ops, which bufferize to buffer allocations.