From 10f0075e907c5591defff94cd6a889d70bdbdd08 Mon Sep 17 00:00:00 2001 From: Anastasia Popova Date: Thu, 16 Sep 2021 11:07:19 +0300 Subject: [PATCH] RandomUniformFusion transformation. (#7187) * Added RandomUniformFusion transformation. * Extended transformations for case with Convert, extended transformations for general min and max value case. * Set to const unchanged variables. * Apply suggestions from code review Co-authored-by: Gleb Kazantaev * Reformat code, small corrections. * Added const shape checks. * Fixed transformation for case of different const ranks. * Added type checks. * Apply suggestions from code review Co-authored-by: Gleb Kazantaev * United RandomUniformMulFusion and RandomUniformAddFusion to single transformation. * Added negative tests. * Used get_constant_from_source(). * Moved transformation to common fusions. * Added const refs. * Update inference-engine/src/transformations/src/transformations/common_optimizations/random_uniform_fusion.cpp Co-authored-by: Gleb Kazantaev * Changed to single class. * Corrected IRs checks in layer tests. * Small corrections. Co-authored-by: Gleb Kazantaev --- .../src/moc_transformations.cpp | 2 + .../random_uniform_fusion.hpp | 28 ++ .../common_optimizations.cpp | 2 + .../random_uniform_fusion.cpp | 92 ++++++ .../random_uniform_fusion_test.cpp | 290 ++++++++++++++++++ .../tensorflow_tests/test_tf_RandomUniform.py | 41 +-- 6 files changed, 429 insertions(+), 26 deletions(-) create mode 100644 inference-engine/src/transformations/include/transformations/common_optimizations/random_uniform_fusion.hpp create mode 100644 inference-engine/src/transformations/src/transformations/common_optimizations/random_uniform_fusion.cpp create mode 100644 inference-engine/tests/functional/inference_engine/transformations/random_uniform_fusion_test.cpp diff --git a/inference-engine/src/offline_transformations/src/moc_transformations.cpp b/inference-engine/src/offline_transformations/src/moc_transformations.cpp index d784930bd4c..40952e9494e 100644 --- a/inference-engine/src/offline_transformations/src/moc_transformations.cpp +++ b/inference-engine/src/offline_transformations/src/moc_transformations.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include "transformations/common_optimizations/mul_conv_fusion.hpp" NGRAPH_RTTI_DEFINITION(ngraph::pass::MOCTransformations, "MOCTransformations", 0); @@ -92,6 +93,7 @@ bool ngraph::pass::MOCTransformations::run_on_function(std::shared_ptradd_matcher(); common_fusions->add_matcher(); common_fusions->add_matcher(); + common_fusions->add_matcher(); common_fusions->set_name("ngraph::pass::CommonFusions"); manager.register_pass(); diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/random_uniform_fusion.hpp b/inference-engine/src/transformations/include/transformations/common_optimizations/random_uniform_fusion.hpp new file mode 100644 index 00000000000..60415fc08df --- /dev/null +++ b/inference-engine/src/transformations/include/transformations/common_optimizations/random_uniform_fusion.hpp @@ -0,0 +1,28 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include + +namespace ngraph { +namespace pass { + +class TRANSFORMATIONS_API RandomUniformFusion; + +} // namespace pass +} // namespace ngraph + +/** + * @ingroup ie_transformation_common_api + * @brief RandomUniformFusion transformation replaces RandomUniform -> Add or + * RandomUniform -> Mul subgraph with a RandomUniform and replaces min and max const + * with corrected values. + */ +class ngraph::pass::RandomUniformFusion : public ngraph::pass::MatcherPass { +public: + NGRAPH_RTTI_DECLARATION; + RandomUniformFusion(); +}; diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp index 2fe165a1e9f..a739e90654a 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp @@ -29,6 +29,7 @@ #include "transformations/common_optimizations/convert_quantize_dequantize.hpp" #include "transformations/common_optimizations/relu_fake_quantize_fusion.hpp" #include "transformations/common_optimizations/disable_random_uniform_constant_folding.hpp" +#include "transformations/common_optimizations/random_uniform_fusion.hpp" #include "transformations/common_optimizations/add_fake_quantize_fusion.hpp" #include "transformations/common_optimizations/mul_fake_quantize_fusion.hpp" #include "transformations/common_optimizations/clamp_fusion.hpp" @@ -139,6 +140,7 @@ bool ngraph::pass::CommonOptimizations::run_on_function(std::shared_ptradd_matcher(); common_fusions->add_matcher(); common_fusions->add_matcher(); + common_fusions->add_matcher(); common_fusions->set_name("ngraph::pass::CommonFusions"); manager.register_pass(); diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/random_uniform_fusion.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/random_uniform_fusion.cpp new file mode 100644 index 00000000000..1d7c3bfbe10 --- /dev/null +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/random_uniform_fusion.cpp @@ -0,0 +1,92 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "transformations/common_optimizations/random_uniform_fusion.hpp" + +#include +#include +#include +#include +#include +#include + +#include "itt.hpp" + +NGRAPH_RTTI_DEFINITION(ngraph::pass::RandomUniformFusion, "RandomUniformFusion", 0); + +ngraph::pass::RandomUniformFusion::RandomUniformFusion() { + MATCHER_SCOPE(RandomUniformFusion); + const auto data_pattern = ngraph::pattern::any_input(); + const auto ru_min_input_pattern = ngraph::pattern::any_input(); + const auto ru_max_input_pattern = ngraph::pattern::any_input(); + const auto random_uniform_pattern = + ngraph::pattern::wrap_type({data_pattern, ru_min_input_pattern, ru_max_input_pattern}, + pattern::consumers_count(1)); + const auto const_pattern = ngraph::pattern::wrap_type(); + + const auto convert_pattern = ngraph::pattern::wrap_type({random_uniform_pattern}); + const auto random_uniform_or_convert_pattern = + std::make_shared(OutputVector{random_uniform_pattern, convert_pattern}); + + const auto mul_add_pattern = + ngraph::pattern::wrap_type({random_uniform_or_convert_pattern, const_pattern}); + + ngraph::matcher_pass_callback callback = [=](pattern::Matcher& m) { + const auto& pattern_map = m.get_pattern_value_map(); + const auto data = pattern_map.at(data_pattern); + const auto random_uniform = pattern_map.at(random_uniform_pattern); + const auto constant = pattern_map.at(const_pattern); + const auto ru = std::dynamic_pointer_cast(random_uniform.get_node_shared_ptr()); + if (!ru) + return false; + if (!ru->get_out_type().is_real()) + return false; + + const auto old_const = std::dynamic_pointer_cast(constant.get_node_shared_ptr()); + if (!old_const) + return false; + if (!old_const->get_element_type().is_real()) + return false; + + auto const_shape = old_const->get_shape(); + if (shape_size(const_shape) != 1) + return false; + + const auto& value = old_const->cast_vector(); + auto new_const = op::Constant::create(ru->get_out_type(), Shape{}, value); + + const auto& mul_add = pattern_map.at(mul_add_pattern); + const auto mul_add_ptr = std::dynamic_pointer_cast(mul_add.get_node_shared_ptr()); + const auto new_mul_add1 = mul_add_ptr->clone_with_new_inputs({ru->input_value(1), new_const}); + const auto new_mul_add2 = mul_add_ptr->clone_with_new_inputs({ru->input_value(2), new_const}); + + const auto& folded_const1 = ngraph::get_constant_from_source(new_mul_add1); + const auto& folded_const2 = ngraph::get_constant_from_source(new_mul_add2); + + const auto new_ru = ru->clone_with_new_inputs({data, + folded_const1 ? folded_const1 : new_mul_add1, + folded_const2 ? folded_const2 : new_mul_add2}); + new_ru->set_friendly_name(m.get_match_root()->get_friendly_name()); + + if (pattern_map.count(convert_pattern)) { + const auto& convert = pattern_map.at(convert_pattern); + const auto cvt = std::dynamic_pointer_cast(convert.get_node_shared_ptr()); + if (!cvt) + return false; + if (!cvt->get_element_type().is_real()) + return false; + const auto new_ru_conv = cvt->clone_with_new_inputs({new_ru}); + copy_runtime_info({ru, cvt, mul_add.get_node_shared_ptr()}, {new_mul_add1, new_mul_add2, new_ru, new_ru_conv}); + ngraph::replace_node(m.get_match_root(), new_ru_conv); + } else { + copy_runtime_info({ru, mul_add.get_node_shared_ptr()}, {new_mul_add1, new_mul_add2, new_ru}); + ngraph::replace_node(m.get_match_root(), new_ru); + } + + return true; + }; + + auto m = std::make_shared(mul_add_pattern, matcher_name); + this->register_matcher(m, callback); +} diff --git a/inference-engine/tests/functional/inference_engine/transformations/random_uniform_fusion_test.cpp b/inference-engine/tests/functional/inference_engine/transformations/random_uniform_fusion_test.cpp new file mode 100644 index 00000000000..36f4ba84542 --- /dev/null +++ b/inference-engine/tests/functional/inference_engine/transformations/random_uniform_fusion_test.cpp @@ -0,0 +1,290 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common_test_utils/ngraph_test_utils.hpp" + +using namespace testing; + +TEST(TransformationTests, RandomUniformMulFusing) { + std::shared_ptr f(nullptr), f_ref(nullptr); + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto min_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {0.0}); + auto max_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {1.0}); + auto ru = std::make_shared(input, + min_const, + max_const, + ngraph::element::f32, + 100, + 200); + + auto mul_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 1}, {30.0}); + auto mul = std::make_shared(ru, mul_const); + + f = std::make_shared(ngraph::NodeVector{mul}, ngraph::ParameterVector{input}); + + ngraph::pass::Manager manager; + manager.register_pass(); + manager.register_pass(); + manager.run_passes(f); + ASSERT_NO_THROW(check_rt_info(f)); + } + + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto min_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {0.0}); + auto max_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {30.0}); + auto ru = std::make_shared(input, + min_const, + max_const, + ngraph::element::f32, + 100, + 200); + + f_ref = std::make_shared(ngraph::NodeVector{ru}, ngraph::ParameterVector{input}); + } + + auto res = compare_functions(f, f_ref); + ASSERT_TRUE(res.first) << res.second; +} + +TEST(TransformationTests, RandomUniformAddFusing) { + std::shared_ptr f(nullptr), f_ref(nullptr); + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto min_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {0.0}); + auto max_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {30.0}); + auto ru = std::make_shared(input, + min_const, + max_const, + ngraph::element::f32, + 100, + 200); + + auto add_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 1, 1}, {-10.0}); + auto add = std::make_shared(ru, add_const); + + f = std::make_shared(ngraph::NodeVector{add}, ngraph::ParameterVector{input}); + + ngraph::pass::Manager manager; + manager.register_pass(); + manager.register_pass(); + manager.run_passes(f); + ASSERT_NO_THROW(check_rt_info(f)); + } + + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto ru_max_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {20.0}); + auto ru_min_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {-10.0}); + auto ru = std::make_shared(input, + ru_min_const, + ru_max_const, + ngraph::element::f32, + 100, + 200); + + f_ref = std::make_shared(ngraph::NodeVector{ru}, ngraph::ParameterVector{input}); + } + + auto res = compare_functions(f, f_ref); + ASSERT_TRUE(res.first) << res.second; +} + +TEST(TransformationTests, RandomUniformWithConvertMulFusing) { + std::shared_ptr f(nullptr), f_ref(nullptr); + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto min_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {0.0}); + auto max_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {1.0}); + auto ru = std::make_shared(input, + min_const, + max_const, + ngraph::element::f32, + 100, + 200); + auto conv = std::make_shared(ru, ngraph::element::f16); + + auto mul_const = ngraph::opset8::Constant::create(ngraph::element::f16, ngraph::Shape{}, {30.0}); + auto mul = std::make_shared(conv, mul_const); + + f = std::make_shared(ngraph::NodeVector{mul}, ngraph::ParameterVector{input}); + + ngraph::pass::Manager manager; + manager.register_pass(); + manager.register_pass(); + manager.run_passes(f); + ASSERT_NO_THROW(check_rt_info(f)); + } + + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto min_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {0.0}); + auto max_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {30.0}); + + auto ru = std::make_shared(input, + min_const, + max_const, + ngraph::element::f32, + 100, + 200); + auto conv = std::make_shared(ru, ngraph::element::f16); + + f_ref = std::make_shared(ngraph::NodeVector{conv}, ngraph::ParameterVector{input}); + } + + auto res = compare_functions(f, f_ref); + ASSERT_TRUE(res.first) << res.second; +} + +TEST(TransformationTests, RandomUniformWithConvertAddFusing) { + std::shared_ptr f(nullptr), f_ref(nullptr); + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto min_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {0.0}); + auto max_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {30.0}); + auto ru = std::make_shared(input, + min_const, + max_const, + ngraph::element::f32, + 100, + 200); + auto conv = std::make_shared(ru, ngraph::element::f16); + + auto add_const = ngraph::opset8::Constant::create(ngraph::element::f16, ngraph::Shape{}, {-10.0}); + auto add = std::make_shared(conv, add_const); + + f = std::make_shared(ngraph::NodeVector{add}, ngraph::ParameterVector{input}); + + ngraph::pass::Manager manager; + manager.register_pass(); + manager.register_pass(); + manager.run_passes(f); + ASSERT_NO_THROW(check_rt_info(f)); + } + + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto ru_min_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {-10.0}); + auto ru_max_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {20.0}); + + auto ru = std::make_shared(input, + ru_min_const, + ru_max_const, + ngraph::element::f32, + 100, + 200); + auto conv = std::make_shared(ru, ngraph::element::f16); + + f_ref = std::make_shared(ngraph::NodeVector{conv}, ngraph::ParameterVector{input}); + } + + auto res = compare_functions(f, f_ref); + ASSERT_TRUE(res.first) << res.second; +} + + +TEST(TransformationTests, RandomUniformFusingInvalidRUType) { + std::shared_ptr f(nullptr), f_ref(nullptr); + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto min_const = ngraph::opset8::Constant::create(ngraph::element::i32, ngraph::Shape{}, {0}); + auto max_const = ngraph::opset8::Constant::create(ngraph::element::i32, ngraph::Shape{}, {100}); + auto ru = std::make_shared(input, + min_const, + max_const, + ngraph::element::i32, + 100, + 200); + + auto mul_const = ngraph::opset8::Constant::create(ngraph::element::i32, ngraph::Shape{}, {30}); + auto mul = std::make_shared(ru, mul_const); + + f = std::make_shared(ngraph::NodeVector{mul}, ngraph::ParameterVector{input}); + + ngraph::pass::Manager manager; + manager.register_pass(); + manager.register_pass(); + manager.run_passes(f); + ASSERT_NO_THROW(check_rt_info(f)); + } + + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto min_const = ngraph::opset8::Constant::create(ngraph::element::i32, ngraph::Shape{}, {0}); + auto max_const = ngraph::opset8::Constant::create(ngraph::element::i32, ngraph::Shape{}, {100}); + auto ru = std::make_shared(input, + min_const, + max_const, + ngraph::element::i32, + 100, + 200); + + auto mul_const = ngraph::opset8::Constant::create(ngraph::element::i32, ngraph::Shape{}, {30}); + auto mul = std::make_shared(ru, mul_const); + + f_ref = std::make_shared(ngraph::NodeVector{mul}, ngraph::ParameterVector{input}); + } + + auto res = compare_functions(f, f_ref); + ASSERT_TRUE(res.first) << res.second; +} + + +TEST(TransformationTests, RandomUniformFusingInvalidConstShape) { + std::shared_ptr f(nullptr), f_ref(nullptr); + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto min_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {0.0}); + auto max_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {1.0}); + auto ru = std::make_shared(input, + min_const, + max_const, + ngraph::element::f32, + 100, + 200); + + auto mul_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{3}, {30, 20, 15}); + auto mul = std::make_shared(ru, mul_const); + + f = std::make_shared(ngraph::NodeVector{mul}, ngraph::ParameterVector{input}); + + ngraph::pass::Manager manager; + manager.register_pass(); + manager.register_pass(); + manager.run_passes(f); + ASSERT_NO_THROW(check_rt_info(f)); + } + + { + auto input = std::make_shared(ngraph::element::i32, ngraph::Shape{3}); + auto min_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {0.0}); + auto max_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{}, {1.0}); + auto ru = std::make_shared(input, + min_const, + max_const, + ngraph::element::f32, + 100, + 200); + + auto mul_const = ngraph::opset8::Constant::create(ngraph::element::f32, ngraph::Shape{3}, {30, 20, 15}); + auto mul = std::make_shared(ru, mul_const); + + f_ref = std::make_shared(ngraph::NodeVector{mul}, ngraph::ParameterVector{input}); + } + + auto res = compare_functions(f, f_ref); + ASSERT_TRUE(res.first) << res.second; +} diff --git a/tests/layer_tests/tensorflow_tests/test_tf_RandomUniform.py b/tests/layer_tests/tensorflow_tests/test_tf_RandomUniform.py index 223b8b76edc..400ea147524 100644 --- a/tests/layer_tests/tensorflow_tests/test_tf_RandomUniform.py +++ b/tests/layer_tests/tensorflow_tests/test_tf_RandomUniform.py @@ -1,7 +1,6 @@ # Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -import numpy as np import pytest import tensorflow as tf from mo.front.common.partial_infer.utils import int64_array @@ -13,7 +12,8 @@ from common.tf_layer_test_class import CommonTFLayerTest class TestTFRandomUniform(CommonTFLayerTest): - def create_tf_random_uniform_net(self, global_seed, op_seed, x_shape, min_val, max_val, input_type, ir_version): + def create_tf_random_uniform_net(self, global_seed, op_seed, x_shape, min_val, max_val, input_type, precision, + ir_version): tf.compat.v1.reset_default_graph() # Create the graph and model @@ -47,33 +47,22 @@ class TestTFRandomUniform(CommonTFLayerTest): nodes_attributes = { **regular_op_with_shaped_data('input', x_shape, {'type': 'Parameter'}), **const_for_layer_tests('shape', x_shape, int64_array([len(x_shape)]), int64_array([len(x_shape)])), - **const_for_layer_tests('min_val_default', 0.0, int64_array([]), int64_array([1])), - **const_for_layer_tests('max_val_default', 1.0, int64_array([]), int64_array([1])), **const_for_layer_tests('min_val', min_val, int64_array([]), int64_array([1])), **const_for_layer_tests('max_val', max_val, int64_array([]), int64_array([1])), **regular_op_with_shaped_data('random_uniform', x_shape, {'type': 'RandomUniform'}), - **regular_op_with_shaped_data('random_uniform_add', x_shape, {'type': 'Add'}), - **const_for_layer_tests('random_uniform_add_const', np.array([[min_val]]), - int64_array([1, 1]) if min_val == 0.0 else int64_array([1]), int64_array([1])), - **regular_op_with_shaped_data('random_uniform_mul', x_shape, {'type': 'Multiply'}), - **const_for_layer_tests('random_uniform_mul_const', [max_val - min_val], - int64_array([1, 1]) if max_val == 1.0 else int64_array([1]), int64_array([1])), + **regular_op_with_shaped_data('convert', x_shape, {'type': 'Convert'}), **regular_op_with_shaped_data('add', x_shape, {'type': 'Add'}), **regular_op_with_shaped_data('result', x_shape, {'type': 'Result'}), } - if input_type == tf.float32: + + if precision == 'FP16' and input_type == tf.float32: ref_net = build_graph(nodes_attributes, [*connect_const_for_layer_tests('shape', '0:random_uniform'), - *connect_const_for_layer_tests('min_val_default', '1:random_uniform'), - *connect_const_for_layer_tests('max_val_default', '2:random_uniform'), - *connect('random_uniform', '0:random_uniform_mul'), - *connect_const_for_layer_tests('random_uniform_mul_const', - '1:random_uniform_mul'), - *connect('random_uniform_mul', '0:random_uniform_add'), - *connect_const_for_layer_tests('random_uniform_add_const', - '1:random_uniform_add'), - *connect('random_uniform_add', '0:add'), + *connect_const_for_layer_tests('min_val', '1:random_uniform'), + *connect_const_for_layer_tests('max_val', '2:random_uniform'), + *connect('random_uniform', 'convert'), + *connect('convert', '0:add'), *connect('input', '1:add'), *connect('add', 'result')]) else: @@ -90,15 +79,15 @@ class TestTFRandomUniform(CommonTFLayerTest): test_data = [pytest.param( dict(global_seed=32465, op_seed=48971, min_val=0.0, max_val=1.0, x_shape=[3, 7], input_type=tf.float32), marks=pytest.mark.precommit), - dict(global_seed=None, op_seed=56197, min_val=-100, max_val=100, x_shape=[6], input_type=tf.float32), - dict(global_seed=78132, op_seed=None, min_val=-200, max_val=-50, x_shape=[5, 8], input_type=tf.int32), - dict(global_seed=4571, op_seed=48971, min_val=1.5, max_val=2.3, x_shape=[7], input_type=tf.float32), - dict(global_seed=32465, op_seed=12335, min_val=-150, max_val=-100, x_shape=[18], input_type=tf.int32)] + dict(global_seed=None, op_seed=56197, min_val=-100, max_val=100, x_shape=[6], input_type=tf.float32), + dict(global_seed=78132, op_seed=None, min_val=-200, max_val=-50, x_shape=[5, 8], input_type=tf.int32), + dict(global_seed=4571, op_seed=48971, min_val=1.5, max_val=2.3, x_shape=[7], input_type=tf.float32), + dict(global_seed=32465, op_seed=12335, min_val=-150, max_val=-100, x_shape=[18], input_type=tf.int32)] @pytest.mark.parametrize("params", test_data) @pytest.mark.nightly def test_tf_random_uniform(self, params, ie_device, precision, ir_version, temp_dir): if ie_device == 'GPU': pytest.skip("RandomUniform is not supported on GPU") - self._test(*self.create_tf_random_uniform_net(**params, ir_version=ir_version), ie_device, precision, - temp_dir=temp_dir, ir_version=ir_version, **params) + self._test(*self.create_tf_random_uniform_net(**params, precision=precision, ir_version=ir_version), ie_device, + precision, temp_dir=temp_dir, ir_version=ir_version, **params)