mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #28533 from abhishek-gola:randomNormalLike_bug_fix
[BUG FIX] RandomNormalLike layer Datatype bug fix
This commit is contained in:
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
mean = params.get<float>("mean", 0.f);
|
||||
scale = params.get<float>("scale", 1.f);
|
||||
int dt = params.get<int>("output_dtype", -1);
|
||||
int dt = params.get<int>("dtype", -1);
|
||||
outputType = dt >= 0 ? onnxDataTypeToCV(static_cast<OnnxDataType>(dt)) : -1;
|
||||
has_seed = params.has("seed");
|
||||
seed = has_seed ? params.get<float>("seed") : 0.f;
|
||||
@@ -87,7 +87,8 @@ public:
|
||||
std::vector<MatShape>& internals) const CV_OVERRIDE
|
||||
{
|
||||
CV_Assert(inputs.size() == (size_t)1);
|
||||
CV_Assert(requiredOutputs == 1);
|
||||
CV_Check(requiredOutputs, requiredOutputs == 0 || requiredOutputs == 1,
|
||||
"RandomNormalLike layer expects one output");
|
||||
outputs.assign(1, inputs[0]);
|
||||
internals.clear();
|
||||
return true;
|
||||
|
||||
@@ -2045,16 +2045,6 @@ void ONNXImporter2::parseRMSNormalization(LayerParams& layerParams, const opencv
|
||||
|
||||
void ONNXImporter2::parseRandomNormalLike(LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto)
|
||||
{
|
||||
if (layerParams.has("dtype"))
|
||||
{
|
||||
int dt = layerParams.get<int>("dtype", -1);
|
||||
if (dt >= 0)
|
||||
{
|
||||
layerParams.set<int>("output_dtype", dataType2cv((opencv_onnx::TensorProto_DataType)dt));
|
||||
}
|
||||
layerParams.erase("dtype");
|
||||
}
|
||||
|
||||
layerParams.type = "RandomNormalLike";
|
||||
addLayer(layerParams, node_proto);
|
||||
}
|
||||
|
||||
@@ -3465,8 +3465,7 @@ TEST_P(Test_ONNX_layers, TopK) {
|
||||
test("top_k_smallest");
|
||||
}
|
||||
|
||||
// BUG: https://github.com/opencv/opencv/issues/28532
|
||||
TEST_P(Test_ONNX_layers, DISABLED_RandomNormalLike_basic)
|
||||
TEST_P(Test_ONNX_layers, RandomNormalLike_basic)
|
||||
{
|
||||
Net net = readNetFromONNX(findDataFile("dnn/onnx/models/random_normal_like.onnx", true));
|
||||
|
||||
@@ -3488,8 +3487,7 @@ TEST_P(Test_ONNX_layers, DISABLED_RandomNormalLike_basic)
|
||||
EXPECT_EQ(countNonZero(out != out2), 0);
|
||||
}
|
||||
|
||||
// BUG: https://github.com/opencv/opencv/issues/28532
|
||||
TEST_P(Test_ONNX_layers, DISABLED_RandomNormalLike_complex)
|
||||
TEST_P(Test_ONNX_layers, RandomNormalLike_complex)
|
||||
{
|
||||
Net net = readNetFromONNX(findDataFile("dnn/onnx/models/random_normal_like_complex.onnx", true));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user