Download ScaleDF_rebuttal/python_dedup_pkgs/onnx/common/status.h from VideoUFO/ResearchData_P1: direct link, hf CLI and curl.
- Browser
- Download file 2.13 kB
-
https://huggingface.co/datasets/VideoUFO/ResearchData_P1/resolve/main/ScaleDF_rebuttal/python_dedup_pkgs/onnx/common/status.h
- Command line
-
hf download hf://datasets/VideoUFO/ResearchData_P1/ScaleDF_rebuttal/python_dedup_pkgs/onnx/common/status.h
-
curl -L -o status.h https://huggingface.co/datasets/VideoUFO/ResearchData_P1/resolve/main/ScaleDF_rebuttal/python_dedup_pkgs/onnx/common/status.h
2.13 kB
| // Copyright (c) ONNX Project Contributors | |
| // | |
| // SPDX-License-Identifier: Apache-2.0 | |
| namespace ONNX_NAMESPACE { | |
| namespace Common { | |
| enum class StatusCategory : std::uint8_t { | |
| NONE = 0, | |
| CHECKER = 1, | |
| OPTIMIZER = 2, | |
| }; | |
| enum class StatusCode : std::uint8_t { | |
| OK = 0, | |
| FAIL = 1, | |
| INVALID_ARGUMENT = 2, | |
| INVALID_PROTOBUF = 3, | |
| }; | |
| class Status { | |
| public: | |
| Status() noexcept = default; | |
| Status(StatusCategory category, StatusCode code, const std::string& msg); | |
| Status(StatusCategory category, StatusCode code); | |
| Status(const Status& other) { | |
| *this = other; | |
| } | |
| Status& operator=(const Status& other) { | |
| if (&other != this) { | |
| if (nullptr == other.state_) { | |
| state_.reset(); | |
| } else if (state_ != other.state_) { | |
| state_ = std::make_unique<State>(*other.state_); | |
| } | |
| } | |
| return *this; | |
| } | |
| Status(Status&&) = default; | |
| Status& operator=(Status&&) = default; | |
| ~Status() = default; | |
| ONNX_API bool IsOK() const noexcept; | |
| ONNX_API StatusCode Code() const noexcept; | |
| ONNX_API StatusCategory Category() const noexcept; | |
| ONNX_API const std::string& ErrorMessage() const; | |
| ONNX_API std::string ToString() const; | |
| bool operator==(const Status& other) const { | |
| return (this->state_ == other.state_) || (ToString() == other.ToString()); | |
| } | |
| bool operator!=(const Status& other) const { | |
| return !(*this == other); | |
| } | |
| ONNX_API static const Status& OK() noexcept; | |
| private: | |
| struct State { | |
| State(StatusCategory cat_, StatusCode code_, std::string msg_) | |
| : category(cat_), code(code_), msg(std::move(msg_)) {} | |
| StatusCategory category = StatusCategory::NONE; | |
| StatusCode code{}; | |
| std::string msg; | |
| }; | |
| static const std::string& EmptyString(); | |
| // state_ == nullptr when if status code is OK. | |
| std::unique_ptr<State> state_; | |
| }; | |
| inline std::ostream& operator<<(std::ostream& out, const Status& status) { | |
| return out << status.ToString(); | |
| } | |
| } // namespace Common | |
| } // namespace ONNX_NAMESPACE | |