Example #1
0
def ReadOperation(proto_file):
    protoname, ext = os.path.splitext(proto_file)
    proto = deepnet_pb2.Operation()
    if ext == '.pbtxt':
        proto_pbtxt = open(proto_file, 'r')
        text_format.Merge(proto_pbtxt.read(), proto)
    else:
        f = gzip.open(proto_file, 'rb')
        proto.ParseFromString(f.read())
        f.close()
    return proto
Example #2
0
def CopyOperation(op):
    copy = deepnet_pb2.Operation()
    copy.CopyFrom(op)
    return copy