예제 #1
0
    def replace_sub_graph(self, graph: Graph, match: dict):
        softplus = match['op']

        name = softplus.soft_get('name', softplus.id)
        exp_node = Exp(graph, {'name': name + '/Exp'}).create_node()
        add_node = create_op_node_with_second_input(graph, Add,
                                                    float_array([1.0]),
                                                    {'name': name + '/Add'})
        log_node = Log(graph, {'name': name + '/Log'}).create_node()
        rename_nodes([(softplus, name + '/Log'), (log_node, name)])

        softplus.in_port(0).get_connection().set_destination(
            exp_node.in_port(0))
        add_node.in_port(0).connect(exp_node.out_port(0))
        log_node.in_port(0).connect(add_node.out_port(0))
        softplus.out_port(0).get_connection().set_source(log_node.out_port(0))
예제 #2
0
 def extract(node):
     Exp.update_node_stat(node)
     return __class__.enabled
예제 #3
0
 def extract(cls, node):
     Exp.update_node_stat(node)
     return cls.enabled