Skip to content
Discussion options

You must be logged in to vote

Unless you want to directly call some hlo method, the easiest way to bootstrap a lowering rule is by applying mlir.lower_fun to the impl rule:

lowering = mlir.lower_fun(new_impl, multiple_results=False)

If you're looking for the syntax to use ConstantOp, it would be something like this:

def lowering(ctx, xx):
  return [hlo.ConstantOp(
            mlir.ir.DenseElementsAttr.get(
              np.array(0.5, dtype=np.float32),
              type=mlir.ir.F32Type.get())
            ).result]

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@krzysztofrusek
Comment options

Answer selected by krzysztofrusek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants