mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Merge pull request #25218 from alexlyulkov:al/int64-tile
Allowed int types in Tile and Reduce layers #25218 Allowed any Mat type in Tile layer. Allowed int64 type in Reduce layer. ONNX tests with int32 and int64 inputs will be added later in a separate PR ### 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 - [x] 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. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
parent
a33de44b0b
commit
f0323fdd1e
@ -131,6 +131,16 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void getTypes(const std::vector<MatType>& inputs,
|
||||||
|
const int requiredOutputs,
|
||||||
|
const int requiredInternals,
|
||||||
|
std::vector<MatType>& outputs,
|
||||||
|
std::vector<MatType>& internals) const CV_OVERRIDE
|
||||||
|
{
|
||||||
|
CV_CheckType(inputs[0], inputs[0] == CV_32F || inputs[0] == CV_32S || inputs[0] == CV_64S || inputs[0] == CV_16F || inputs[0] == CV_8U, "");
|
||||||
|
outputs.assign(1, inputs[0]);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class ReduceBase {
|
class ReduceBase {
|
||||||
public:
|
public:
|
||||||
@ -491,6 +501,7 @@ public:
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case CV_8U: opDispatch<uint8_t>(std::forward<Args>(args)...); break;
|
case CV_8U: opDispatch<uint8_t>(std::forward<Args>(args)...); break;
|
||||||
case CV_32S: opDispatch<int32_t>(std::forward<Args>(args)...); break;
|
case CV_32S: opDispatch<int32_t>(std::forward<Args>(args)...); break;
|
||||||
|
case CV_64S: opDispatch<int64_t>(std::forward<Args>(args)...); break;
|
||||||
case CV_32F: opDispatch<float>(std::forward<Args>(args)...); break;
|
case CV_32F: opDispatch<float>(std::forward<Args>(args)...); break;
|
||||||
default: CV_Error(cv::Error::BadDepth, "DNN/Reduce: Unsupported type.");
|
default: CV_Error(cv::Error::BadDepth, "DNN/Reduce: Unsupported type.");
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,15 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(requiredOutputs, inputs[0]);
|
||||||
|
}
|
||||||
|
|
||||||
void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE
|
void forward(InputArrayOfArrays inputs_arr, OutputArrayOfArrays outputs_arr, OutputArrayOfArrays internals_arr) CV_OVERRIDE
|
||||||
{
|
{
|
||||||
CV_TRACE_FUNCTION();
|
CV_TRACE_FUNCTION();
|
||||||
|
Loading…
Reference in New Issue
Block a user