示例#1
0
    def test_proposal_infer_one_output(self):
        graph = build_graph(nodes_attributes,
                            [('proposal_input', 'proposal'),
                             ('proposal', 'proposal_out_data_1'),
                             ('proposal_out_data_1', 'op_output')
                             ],
                            {'proposal_input': {'shape': int64_array([1, 3, 227, 227])},
                             'proposal': {'post_nms_topn': 2, **layout_attrs()}
                             })

        proposal_node = Node(graph, 'proposal')
        ProposalOp.proposal_infer(proposal_node)

        self.assertListEqual([1 * 2, 5], list(graph.node['proposal_out_data_1']['shape']))
示例#2
0
    def test_proposal_infer(self):
        graph = build_graph(nodes_attributes,
                            [('node_1', 'proposal'),
                             ('proposal', 'node_3')],
                            {'node_3': {'is_output': True, 'shape': None},
                             'node_1': {'shape': np.array([1, 3, 227, 227])},
                             'proposal': {'post_nms_topn': 2, **layout_attrs()}
                             })

        proposal_node = Node(graph, 'proposal')
        ProposalOp.proposal_infer(proposal_node)
        exp_shape = np.array([1 * 2, 5])
        res_shape = graph.node['node_3']['shape']
        for i in range(0, len(exp_shape)):
            self.assertEqual(exp_shape[i], res_shape[i])