def test_first_input_coeff_not_1(self):
        graph = build_graph(nodes_attributes, [
            ('placeholder_1', 'eltwise'),
            ('placeholder_2', 'eltwise'),
            ('eltwise', 'sigmoid_1'),
            ('eltwise', 'sigmoid_2'),
        ], {'eltwise': {
            'coeff': np.array([2.0, 1.0])
        }},
                            nodes_with_edges_only=True)
        graph.stage = 'front'

        graph_ref = build_graph(nodes_attributes, [
            ('placeholder_1', 'mul_1'),
            ('const_1', 'mul_1'),
            ('mul_1', 'eltwise'),
            ('placeholder_2', 'eltwise'),
            ('eltwise', 'sigmoid_1'),
            ('eltwise', 'sigmoid_2'),
        ], {
            'const_1': {
                'value': const_1_value,
                'shape': const_1_value.shape
            },
        },
                                nodes_with_edges_only=True)

        EltwiseAddNormalize().find_and_replace_pattern(graph)

        (flag, resp) = compare_graphs(graph,
                                      graph_ref,
                                      'placeholder_1',
                                      check_op_attrs=True)
        self.assertTrue(flag, resp)
    def test_both_input_coeff_not_defined(self):
        graph = build_graph(nodes_attributes, [
            ('placeholder_1', 'eltwise'),
            ('placeholder_2', 'eltwise'),
            ('eltwise', 'sigmoid_1'),
            ('eltwise', 'sigmoid_2'),
        ], {'eltwise': {
            'coeff': None
        }},
                            nodes_with_edges_only=True)
        graph.stage = 'front'

        graph_ref = build_graph(nodes_attributes, [
            ('placeholder_1', 'eltwise'),
            ('placeholder_2', 'eltwise'),
            ('eltwise', 'sigmoid_1'),
            ('eltwise', 'sigmoid_2'),
        ], {},
                                nodes_with_edges_only=True)

        EltwiseAddNormalize().find_and_replace_pattern(graph)

        (flag, resp) = compare_graphs(graph,
                                      graph_ref,
                                      'placeholder_1',
                                      check_op_attrs=True)
        self.assertTrue(flag, resp)