tvm_tirx.ir.make_node

Contents

tvm_tirx.ir.make_node#

tvm_tirx.ir.make_node(type_key, /, **kwargs)#

Make a new IR node by its type key and fields

Parameters:
  • type_key (str) – The type key of the node.

  • **kwargs (dict) – The fields of the node. For ir.DictAttrs, these are the dictionary entries.

Returns:

node (Node) – The corresponding IR Node

Note

If the created node is instance of AttrsObj, then the creator function will also run bound checks and default value setup as supported by Attrs.

Example

The following code constructs a IntImm object

x = tvm_tirx.ir.make_node(
    "ir.IntImm", ty=tvm_tirx.ir.PrimType("int32"), value=10, loc=tvm_tirx.ir.UnknownLoc()
)
assert isinstance(x, tvm_tirx.ir.IntImm)
assert x.value == 10