Пример #1
0
 def _load_tf_node(self, node):
     self.node = node
     self.name = node.name
     self.inputs = list(node.input)
     self.attr = {}
     for key, val in node.attr.items():
         new_val = attr_translator.translate_tf(key, val)
         if isinstance(new_val, AttrValue):
             new_val = attr_converter.convert_tf(new_val)
         self.attr[key] = new_val
     splitted_op_name = node.op.split(".")
     self.domain = "" if len(splitted_op_name) == 1 else ".".join(
         splitted_op_name[:-1])
     self.op_type = splitted_op_name[-1]
Пример #2
0
    def __init__(self, node_proto):
        # storing a reference to the original protobuf object
        self.node_proto = node_proto
        self.name = node_proto.name
        self.inputs = list(node_proto.input)
        self.attr = {}

        for key, val in node_proto.attr.items():
            new_val = attr_translator.translate_tf(key, val)

            if isinstance(new_val, AttrValue):
                new_val = attr_converter.convert_tf(new_val)

            self.attr[key] = new_val

        splitted_op_name = node_proto.op.split(".")
        self.domain = "" if len(splitted_op_name) == 1 else ".".join(
            splitted_op_name[:-1])
        self.op_type = splitted_op_name[-1]