6 #ifndef SHARED_PROVIDER
15 namespace onnxruntime {
22 template <
class Impl_t>
53 return GetAttr<T>(name, &tmp).IsOK() ? tmp : default_value;
62 if (!GetAttr<T>(name, value).IsOK())
63 *value = default_value;
72 const std::vector<T>& default_value = {})
const {
74 return GetAttrs<T>(name, tmp).IsOK() ? tmp : default_value;
96 return GetAttrs(name, tmp).IsOK() ? tmp : default_value;
102 template <
typename T>
105 template <
typename T>
109 std::vector<std::reference_wrapper<const std::string>>& refs)
const;
118 return gsl::narrow_cast<uint32_t>(impl_->getNumInputs());
122 return gsl::narrow_cast<uint32_t>(impl_->getNumOutputs());
126 return impl_->getInputType(index);
131 return const_cast<Impl_t*
>(impl_)->getOutputType(index);
136 return impl_->getAttribute(name);
147 const Impl_t* impl_ =
nullptr;
T GetAttr(const std::string &name) const
void GetAttrOrDefault(const std::string &name, T *value, const T &default_value) const
ProtoHelperNodeContext(const onnxruntime::Node &node)
T GetAttrOrDefault(const std::string &name, const T &default_value) const
ProtoHelperNodeContext()=delete
uint32_t GetPrimitiveAttrElementCount(ONNX_NAMESPACE::AttributeProto_AttributeType type, const std::string &name) const noexcept
GLsizei const GLchar *const * string
GLsizei const GLfloat * value
const ONNX_NAMESPACE::AttributeProto * TryGetAttribute(const std::string &name) const
#define ORT_ENFORCE(condition,...)
bool HasPrimitiveAttribute(ONNX_NAMESPACE::AttributeProto_AttributeType type, const std::string &name) const noexcept
Status GetAttr(const std::string &name, T *value) const
TensorShapeVector GetAttrsOrDefault(const std::string &name, const TensorShapeVector &default_value={}) const
InlinedVector< int64_t > TensorShapeVector
uint32_t GetInputCount() const
OpNodeProtoHelper(const Impl_t *impl)
uint32_t GetOutputCount() const
const ONNX_NAMESPACE::TypeProto * getInputType(size_t index) const
size_t getNumOutputs() const
const ONNX_NAMESPACE::TypeProto * GetInputType(size_t index) const
GLuint const GLchar * name
const ONNX_NAMESPACE::AttributeProto * GetAttribute(const std::string &name) const
Status GetAttrs(const std::string &name, TensorShapeVector &out) const
std::vector< T > GetAttrsOrDefault(const std::string &name, const std::vector< T > &default_value={}) const
GLenum GLsizei GLsizei GLint * values
const ONNX_NAMESPACE::TypeProto * GetOutputType(size_t index) const
const ONNX_NAMESPACE::TypeProto * getOutputType(size_t index) const
const ONNX_NAMESPACE::AttributeProto * getAttribute(const std::string &name) const
size_t getNumInputs() const
Status GetAttrsAsSpan(const std::string &name, gsl::span< const T > &values) const
Return a gsl::span that points to an array of primitive types held by AttributeProto This function al...
#define ORT_THROW_IF_ERROR(expr)
Status GetAttrsStringRefs(const std::string &name, std::vector< std::reference_wrapper< const std::string >> &refs) const