Return a extenOp graph from topi including one of the externOp's input is o Const Value

hello,everybody, I want to return a externOp graph from topi , and maybe one of the externOp’s input is a Const Value, does this possible? and I wonder how can I turn a const value to a tvm::tensor? for I walked through the ExternOp code in python, it only accept tvm::tensor as inputs argument.
Thanks!!

You can use ComputeOp to create a constant tensor. For example,

t = tvm.compute((), lambda: 1., name="const", tag=tag.BROADCAST)

ok, get it. Thank you very much.

I try this method, I get another problem, In the python extern api function, I can use decl_buffer function to alloc space to this tensor , it’s shape is []. But when tvm ir.storage_flattern() is executed, it report cannot find buffer of compute(const ,0x3771100) ,how should i do ?? Thanks!!

Could you provide the example to your problem? Otherwise, it’s hard to provide a solution to it. Another thing you can try is to call schedule_injective to the constant tensor.

The relay cosh operator is divided into a combination of trigonometric functions, (e (x) + e (-x)) / 2, the total graph can be seen in blow graph.

so that the operator can be realized only by basic topi combination. when tvm ir.pass.storage_flattern() is executed and traversal the div tensor 's AttrStmt , it report cannot find buffer of compute(const ,0x3771100), as it is div 2 operation, is this clear?Actually, I don’t really understand schedule_injective, I will learn about it next week.

Why don’t you just create a placeholder for constant 2?

placeholder api offers three arguments shape, dtype and name, Where should the data be stored?

placeholder api offers three arguments shape, dtype and name, Where should the data be stored?

Data should be provided in your inputs.