File size: 528 Bytes
b554a07 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | // Copyright (c) ONNX Project Contributors
//
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <nanobind/nanobind.h>
#include "onnx/proto_utils.h"
namespace ONNX_NAMESPACE {
namespace nb = nanobind;
template <typename Proto>
bool ParseProtoFromPyBytes(Proto* proto, const nb::bytes& bytes) {
// Get the buffer from Python bytes object
auto buffer = static_cast<const char*>(bytes.data());
size_t length = bytes.size();
return ParseProtoFromBytes(proto, buffer, length);
}
} // namespace ONNX_NAMESPACE
|