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

Fixed type mismatch

This commit is contained in:
Abhishek Gola
2025-08-11 12:12:17 +05:30
committed by Alexander Smorkalov
parent b35104d63d
commit 4e71abeaf6
4 changed files with 38 additions and 41 deletions
+6 -9
View File
@@ -22,7 +22,6 @@ class TriluLayerImpl CV_FINAL : public TriluLayer {
return false;
}
void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE {
std::vector<Mat> inputs, outputs;
inputs_arr.getMatVector(inputs);
@@ -42,18 +41,19 @@ class TriluLayerImpl CV_FINAL : public TriluLayer {
for (int i = 0; i < cdims; ++i)
loops *= shape_input[i];
float *dst = outputs[0].ptr<float>();
const size_t elemSize = outputs[0].elemSize();
uchar *dst = outputs[0].ptr<uchar>();
auto fn = [&](const Range &r) {
for (int i = r.start; i < r.end; i++) {
for(int l=0; l < m; l+=1) {
int cmin = upperTri ? 0 : (l + k + 1);
cmin = std::max(cmin, 0);
const int cmax = upperTri ? min(l + k -1, w-1) : w-1;
const int num_zeros = cmax - cmin + 1;
auto *cur_dst = dst + ((w * h) * i + (w * l + cmin));
size_t offset = (static_cast<size_t>(w) * h * i + (static_cast<size_t>(w) * l + cmin)) * elemSize;
auto *cur_dst = dst + offset;
if (cmin < w && num_zeros > 0)
std::memset(cur_dst, 0, sizeof(float) * num_zeros);
std::memset(cur_dst, 0, elemSize * num_zeros);
}
}
};
@@ -62,24 +62,21 @@ class TriluLayerImpl CV_FINAL : public TriluLayer {
parallel_for_(Range(0, loops), fn, nstripes);
}
void getTypes(const std::vector<MatType>& inputs,
const int requiredOutputs,
const int requiredInternals,
std::vector<MatType>& outputs,
std::vector<MatType>& internals) const CV_OVERRIDE
{
outputs.assign(1, CV_32F);
outputs.assign(1, inputs[0]);
}
private:
bool upperTri;
};
Ptr<TriluLayer> TriluLayer::create(const LayerParams& params)
{
return makePtr<TriluLayerImpl>(params);
}
}}
@@ -2058,39 +2058,39 @@ CASE(test_transpose_all_permutations_5)
CASE(test_transpose_default)
// no filter
CASE(test_tril)
// no filter
SKIP;
CASE(test_tril_neg)
// no filter
SKIP;
CASE(test_tril_one_row_neg)
// no filter
SKIP;
CASE(test_tril_out_neg)
// no filter
SKIP;
CASE(test_tril_out_pos)
// no filter
SKIP;
CASE(test_tril_pos)
// no filter
SKIP;
CASE(test_tril_square)
// no filter
SKIP;
CASE(test_tril_square_neg)
// no filter
SKIP;
CASE(test_tril_zero)
// no filter
CASE(test_triu)
// no filter
SKIP;
CASE(test_triu_neg)
// no filter
SKIP;
CASE(test_triu_one_row)
// no filter
SKIP;
CASE(test_triu_out_neg_out)
// no filter
SKIP;
CASE(test_triu_out_pos)
// no filter
SKIP;
CASE(test_triu_pos)
// no filter
SKIP;
CASE(test_triu_square)
// no filter
SKIP;
CASE(test_triu_square_neg)
// no filter
SKIP;
CASE(test_triu_zero)
// no filter
CASE(test_unique_not_sorted_without_axis)
@@ -75,3 +75,19 @@
"test_isinf",
"test_isinf_negative",
"test_isinf_positive",
"test_tril",
"test_tril_neg",
"test_tril_one_row_neg",
"test_tril_out_neg",
"test_tril_out_pos",
"test_tril_pos",
"test_tril_square",
"test_tril_square_neg",
"test_triu",
"test_triu_neg",
"test_triu_one_row",
"test_triu_out_neg_out",
"test_triu_out_pos",
"test_triu_pos",
"test_triu_square",
"test_triu_square_neg",
@@ -334,23 +334,7 @@
"test_training_dropout_mask", // ---- same as above ---
"test_training_dropout_zero_ratio", // ---- same as above ---
"test_training_dropout_zero_ratio_mask", // ---- same as above ---
"test_tril", // Issue:: Parser: Can't create layer "onnx_node_output_0!y" of type "Trilu" in function 'getLayerInstance'
"test_tril_neg", // ---- same as above ---
"test_tril_one_row_neg", // ---- same as above ---
"test_tril_out_neg", // ---- same as above ---
"test_tril_out_pos", // ---- same as above ---
"test_tril_pos", // ---- same as above ---
"test_tril_square", // ---- same as above ---
"test_tril_square_neg", // ---- same as above ---
"test_tril_zero", // ---- same as above ---
"test_triu", // ---- same as above ---
"test_triu_neg", // ---- same as above ---
"test_triu_one_row", // ---- same as above ---
"test_triu_out_neg_out", // ---- same as above ---
"test_triu_out_pos", // ---- same as above ---
"test_triu_pos", // ---- same as above ---
"test_triu_square", // ---- same as above ---
"test_triu_square_neg", // ---- same as above ---
"test_triu_zero", // ---- same as above ---
"test_unique_not_sorted_without_axis", // Issue:: Parser: Can't create layer "onnx_node_output_0!Y" of type "Unique" in function 'getLayerInstance'
"test_unique_sorted_with_axis", // ---- same as above ---