microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
operators/text/re2_strings/string_regex_replace.hpp
24lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "ocos.h" |
| 7 | #include "string_utils.h" |
| 8 | |
| 9 | struct KernelStringRegexReplace : BaseKernel { |
| 10 | KernelStringRegexReplace(const OrtApi& api, const OrtKernelInfo* info); |
| 11 | void Compute(OrtKernelContext* context); |
| 12 | |
| 13 | protected: |
| 14 | int64_t global_replace_; |
| 15 | }; |
| 16 | |
| 17 | struct CustomOpStringRegexReplace : OrtW::CustomOpBase<CustomOpStringRegexReplace, KernelStringRegexReplace> { |
| 18 | void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const; |
| 19 | const char* GetName() const; |
| 20 | size_t GetInputTypeCount() const; |
| 21 | ONNXTensorElementDataType GetInputType(size_t index) const; |
| 22 | size_t GetOutputTypeCount() const; |
| 23 | ONNXTensorElementDataType GetOutputType(size_t index) const; |
| 24 | }; |
| 25 | |