How to use the visualdl.server.model.onnx.onnx_pb2.ModelProto function in visualdl

To help you get started, we’ve selected a few visualdl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PaddlePaddle / VisualDL / visualdl / server / model / onnx / __init__.py View on Github external
def load_from_string(s):
    '''
    Loads a binary string that stores onnx model

    @params
    Takes a string object containing protobuf
    @return ONNX ModelProto object
    '''
    model = ModelProto()
    decoded = model.ParseFromString(s)
    # in python implementation ParseFromString returns None
    if decoded is not None and decoded != len(s):
        return None

#         raise google.protobuf.message.DecodeError(
#             "Protobuf decoding consumed too few bytes: {} out of {}".format(
#                 decoded, len(s)))
    return model