napronald opened a new pull request, #20053:
URL: https://github.com/apache/tvm/pull/20053

   ## Summary
   
   Fixes two issues in the Relax ONNX `LpPool` converter:
   
   - Computes `|x|^p` instead of `x^p`, matching the [official ONNX reference 
implementation](https://github.com/onnx/onnx/blob/main/onnx/reference/ops/op_pool_common.py#L255).
   - Passes the TVM dtype directly to `relax.const`, avoiding a NumPy dtype 
conversion failure.
   
   ## Minimal reproduce
   
   ```python
   import onnx
   from tvm.relax.frontend.onnx import from_onnx
   
   model = onnx.helper.make_model(
       onnx.helper.make_graph(
           [
               onnx.helper.make_node(
                   "LpPool",
                   ["x"],
                   ["y"],
                   kernel_shape=[2],
                   strides=[1],
                   p=1,
               )
           ],
           "lppool_repro",
           [onnx.helper.make_tensor_value_info("x", onnx.TensorProto.FLOAT, [1, 
1, 4])],
           [onnx.helper.make_tensor_value_info("y", onnx.TensorProto.FLOAT, [1, 
1, 3])],
       ),
       opset_imports=[onnx.helper.make_opsetid("", 18)],
   )
   
   print(from_onnx(model, opset=18).script())
   ```
   
   conversion failed with:
   
   ```text
   ValueError: Could not convert T.float32 to a NumPy dtype
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to