Closed ariaghora closed 6 months ago
@ariaghora looks good to me! Two things before I can merge this:
@pixelspark nice! Few things to clarify:
wonnx-py/tests/test_onnx_backend.py
and adding something like backend_test.include(f"test_hard_sigmoid_[a-z,_]*")
? I'll check if they have tests for this op, anyway.@pixelspark nice! Few things to clarify:
Should I put checkmark indicating support only on "Implemented" column, or should I put it on "Shape inference supported" column as well? I'm not sure about the second one (since I didn't explicitly implement shape inference stuff).
By "enable the HardSigmoid test(s)" do you mean modifying
wonnx-py/tests/test_onnx_backend.py
and adding something likebackend_test.include(f"test_hard_sigmoid_[a-z,_]*")
? I'll check if they have tests for this op, anyway.
Yes and yes! (And no need to enable the test if there is none of course. If it fails for some reason but the op is still useful, just leave the test disabled and make a note somewhere)
Shape inference is not too difficult to implement, I assume you can just add this op in the list with other ops that take one input and provide one output with exactly the same shape. Then of course you can insert two checkmarks in the readme.
@pixelspark Yes, it gives an output with the same shape as the input. I put two checkmarks.
One more thing: some tests failed due to unimplemented CastLike
node. Is it a known issue?
==================================================================================== short test summary info ====================================================================================
FAILED tests/test_specific_op.py::OnnxBackendNodeModelTest::test_hardsigmoid_default_expanded_ver18_cpu - pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: GpuError(CompileError { node: "CastLike", error: UnimplementedOp("CastLike") })
FAILED tests/test_specific_op.py::OnnxBackendNodeModelTest::test_hardsigmoid_example_expanded_ver18_cpu - pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: GpuError(CompileError { node: "CastLike", error: UnimplementedOp("CastLike") })
FAILED tests/test_specific_op.py::OnnxBackendNodeModelTest::test_hardsigmoid_expanded_ver18_cpu - pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: GpuError(CompileError { node: "CastLike", error: UnimplementedOp("CastLike") })
===================================================================== 3 failed, 3 passed, 2628 skipped, 1 warning in 2.51s ======================================================================
Other than that, I guess it is ready.
@pixelspark Yes, it gives an output with the same shape as the input. I put two checkmarks.
One more thing: some tests failed due to unimplemented
CastLike
node. Is it a known issue?==================================================================================== short test summary info ==================================================================================== FAILED tests/test_specific_op.py::OnnxBackendNodeModelTest::test_hardsigmoid_default_expanded_ver18_cpu - pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: GpuError(CompileError { node: "CastLike", error: UnimplementedOp("CastLike") }) FAILED tests/test_specific_op.py::OnnxBackendNodeModelTest::test_hardsigmoid_example_expanded_ver18_cpu - pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: GpuError(CompileError { node: "CastLike", error: UnimplementedOp("CastLike") }) FAILED tests/test_specific_op.py::OnnxBackendNodeModelTest::test_hardsigmoid_expanded_ver18_cpu - pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: GpuError(CompileError { node: "CastLike", error: UnimplementedOp("CastLike") }) ===================================================================== 3 failed, 3 passed, 2628 skipped, 1 warning in 2.51s ======================================================================
Other than that, I guess it is ready.
I think CastLike
is not implemented - just disable these tests for now. I will then merge this PR (finally :-))
I disabled the tests.
(off-topic: is CastLike being implemented now? I might be able to help on this.)
I disabled the tests.
OK, will run CI and then merge. Thanks!
(off-topic: is CastLike being implemented now? I might be able to help on this.)
Not as far as I know, feel free to go ahead!
This pull request introduces the HardSigmoid operation into the existing framework.
Motivation:
Several recent and good-performing OCR models (such as those found in PaddleOCR) utilize ConvTranspose and HardSigmoid. The ConvTranspose PR (#182) is currently in progress, and with anticipation for its completion, I decided to help implementing HardSigmoid part.
Changes:
wonnx/src/compiler.rs
wonnx/templates/snippets/activation_scalar.wgsl
andwonnx/templates/snippets/activation_vec.wgsl
(not sure whether I should implement for both files, but modified both, anyway)wonnx/tests/hard_sigmoid.rs
as I was not sure where to put tests for activation function like thisPlease review the changes and merge if you're OK. Feel free to request any modifications if necessary.