// Copyright (c) OpenMMLab. All rights reserved. #ifndef ORT_MMCV_UTILS_H #define ORT_MMCV_UTILS_H #include #include namespace mmdeploy { struct OrtTensorDimensions : std::vector { OrtTensorDimensions(Ort::CustomOpApi ort, const OrtValue* value) { OrtTensorTypeAndShapeInfo* info = ort.GetTensorTypeAndShape(value); std::vector::operator=(ort.GetTensorShape(info)); ort.ReleaseTensorTypeAndShapeInfo(info); } }; std::vector& get_mmdeploy_custom_ops(); template class OrtOpsRegistrar { public: OrtOpsRegistrar() { get_mmdeploy_custom_ops().push_back(&instance); } private: T instance{}; }; #define REGISTER_ONNXRUNTIME_OPS(name) \ static OrtOpsRegistrar OrtOpsRegistrar##name {} } // namespace mmdeploy #endif // ORT_MMCV_UTILS_H