1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge pull request #27527 from nklskyoy:trilu-layer

Trilu layer #27527

Trilu layer https://onnx.ai/onnx/operators/onnx__Trilu.html is needed for importing paligemma

Merged with https://github.com/opencv/opencv_extra/pull/1264

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [ ] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
nklskyoy
2025-07-17 07:55:07 +02:00
committed by GitHub
parent 7a2f2a985f
commit 06a78c2390
5 changed files with 183 additions and 0 deletions
+81
View File
@@ -1327,6 +1327,87 @@ TEST_P(Test_ONNX_layers, Split_EltwiseMax)
#endif
testONNXModels("split_max");
}
TEST_P(Test_ONNX_layers, trilu_tril)
{
testONNXModels("trilu_tril", npy, 0, 0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_tril_neg)
{
testONNXModels("trilu_tril_neg", npy, 0, 0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_tril_one_row)
{
testONNXModels("trilu_tril_one_row", npy, 0, 0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_tril_one_row1D)
{
testONNXModels("trilu_tril_one_row1D", npy, 0, 0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_tril_out_neg)
{
testONNXModels("trilu_tril_out_neg", npy, 0, 0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_tril_out_pos)
{
testONNXModels("trilu_tril_out_pos", npy, 0, 0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_tril_pos)
{
testONNXModels("trilu_tril_pos", npy, 0, 0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_tril_square)
{
testONNXModels("trilu_tril_square", npy, 0, 0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_tril_square_neg)
{
testONNXModels("trilu_tril_square_neg", npy, 0, 0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_triu)
{
testONNXModels("trilu_triu", npy, 0, 0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_triu_one_row)
{
testONNXModels("trilu_triu_one_row", npy, 0,0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_triu_out_neg)
{
testONNXModels("trilu_triu_out_neg_out", npy, 0,0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_triu_out_pos)
{
testONNXModels("trilu_triu_out_pos", npy, 0,0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_triu_pos)
{
testONNXModels("trilu_triu_pos", npy, 0,0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_triu_square)
{
testONNXModels("trilu_triu_square", npy, 0,0,false, true, 2);
}
TEST_P(Test_ONNX_layers, trilu_triu_square_neg)
{
testONNXModels("trilu_triu_square_neg", npy, 0,0,false, true, 2);
}
// Fails with the new engine. Output shape [?, N, OutputSize] not supported by new graph engine
TEST_P(Test_ONNX_layers, LSTM_Activations)
{