Download ScaleDF_rebuttal/python_dedup_pkgs/onnx/common/assertions.cc from VideoUFO/ResearchData_P1: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/datasets/VideoUFO/ResearchData_P1/resolve/main/ScaleDF_rebuttal/python_dedup_pkgs/onnx/common/assertions.cc
- Command line
-
hf download hf://datasets/VideoUFO/ResearchData_P1/ScaleDF_rebuttal/python_dedup_pkgs/onnx/common/assertions.cc
-
curl -L -o assertions.cc https://huggingface.co/datasets/VideoUFO/ResearchData_P1/resolve/main/ScaleDF_rebuttal/python_dedup_pkgs/onnx/common/assertions.cc
1.42 kB
| // Copyright (c) ONNX Project Contributors | |
| // | |
| // SPDX-License-Identifier: Apache-2.0 | |
| // ATTENTION: The code in this file is highly EXPERIMENTAL. | |
| // Adventurous users should note that the APIs will probably change. | |
| namespace ONNX_NAMESPACE { | |
| std::string barf(const char* fmt, ...) { // NOLINT(modernize-avoid-variadic-functions) | |
| constexpr size_t buffer_size = 2048; | |
| std::array<char, buffer_size> msg{}; | |
| va_list args; | |
| va_start(args, fmt); | |
| // use fixed length for buffer "msg" to avoid buffer overflow | |
| // Suppress -Wformat-nonliteral: fmt comes from the variadic parameter, | |
| // and call sites are checked via the format attribute on the declaration. | |
| vsnprintf(static_cast<char*>(msg.data()), msg.size() - 1, fmt, args); | |
| // ensure null-terminated string to avoid out of bounds read | |
| msg.back() = '\0'; | |
| va_end(args); | |
| return std::string(msg.data()); | |
| } | |
| void throw_assert_error(std::string& msg) { | |
| ONNX_THROW_EX(assert_error(msg)); | |
| } | |
| void throw_tensor_error(std::string& msg) { | |
| ONNX_THROW_EX(tensor_error(msg)); | |
| } | |
| } // namespace ONNX_NAMESPACE | |