def linalg_generic(self, iterator_types: List[str]): assert all(iterator in ["parallel", "reduction"] for iterator in iterator_types) array_attr = ast.ArrayAttr([ ast.StringAttr(ast.StringLiteral(it), None) for it in iterator_types ]) op = linalg.LinalgGeneric( 0, None, None, ast.Region([]), None, None, None, None, None, ast.AttributeDict( [ast.AttributeEntry("iterator_types", array_attr)])) self._insert_op_in_block([], op) return op
def string_literal(self, s): return astnodes.StringLiteral(s[1:-1].replace('\\"', '"'))