microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
operators/text/re2_strings/string_regex_split.hpp
22lines · 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 | // See https://github.com/tensorflow/text/blob/master/docs/api_docs/python/text/regex_split_with_offsets.md. |
| 10 | struct KernelStringRegexSplitWithOffsets : BaseKernel { |
| 11 | KernelStringRegexSplitWithOffsets(const OrtApi& api, const OrtKernelInfo* info); |
| 12 | void Compute(OrtKernelContext* context); |
| 13 | }; |
| 14 | |
| 15 | struct CustomOpStringRegexSplitWithOffsets : OrtW::CustomOpBase<CustomOpStringRegexSplitWithOffsets, KernelStringRegexSplitWithOffsets> { |
| 16 | void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const; |
| 17 | const char* GetName() const; |
| 18 | size_t GetInputTypeCount() const; |
| 19 | ONNXTensorElementDataType GetInputType(size_t index) const; |
| 20 | size_t GetOutputTypeCount() const; |
| 21 | ONNXTensorElementDataType GetOutputType(size_t index) const; |
| 22 | }; |
| 23 | |