예제 #1
0
def _InitOpDefLibrary(op_list_proto_bytes):
    op_list = _op_def_pb2.OpList()
    op_list.ParseFromString(op_list_proto_bytes)
    _op_def_registry.register_op_list(op_list)
    op_def_lib = _op_def_library.OpDefLibrary()
    op_def_lib.add_op_list(op_list)
    return op_def_lib
예제 #2
0
def _InitOpDefLibrary():
    op_list = _op_def_pb2.OpList()
    _text_format.Merge(_InitOpDefLibrary.op_list_ascii, op_list)
    _op_def_registry.register_op_list(op_list)
    op_def_lib = _op_def_library.OpDefLibrary()
    op_def_lib.add_op_list(op_list)
    return op_def_lib
예제 #3
0
def _create_op_def_library(op_protos):
    for op_proto in op_protos:
        registered_ops = _registry.get_registered_ops()
        if op_proto.name not in registered_ops:
            raise LookupError("Op with name {0} not registered".format(
                op_proto.name))

        op_def_lib = _op_def_library.OpDefLibrary()
        ops_proto = _op_def_pb2.OpList()
        ops_proto.op.extend([op_proto])

    # Fails if the interfaces ("op schemas") don't match between the
    # previously registered op and this one.
    _registry.register_op_list(ops_proto)

    op_def_lib.add_op_list(ops_proto)

    return op_def_lib