Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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