microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
operators/text/op_equal.cc
37lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | #include "op_equal.hpp" |
| 5 | #include "op_equal_impl.hpp" |
| 6 | #include <string> |
| 7 | |
| 8 | KernelStringEqual::KernelStringEqual(OrtApi api) : BaseKernel(api) { |
| 9 | } |
| 10 | |
| 11 | void KernelStringEqual::Compute(OrtKernelContext* context) { |
| 12 | KernelEqual_Compute<std::string>(api_, ort_, context); |
| 13 | } |
| 14 | |
| 15 | size_t CustomOpStringEqual::GetInputTypeCount() const { |
| 16 | return 2; |
| 17 | }; |
| 18 | |
| 19 | size_t CustomOpStringEqual::GetOutputTypeCount() const { |
| 20 | return 1; |
| 21 | }; |
| 22 | |
| 23 | ONNXTensorElementDataType CustomOpStringEqual::GetOutputType(size_t /*index*/) const { |
| 24 | return ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL; |
| 25 | }; |
| 26 | |
| 27 | void* CustomOpStringEqual::CreateKernel(OrtApi api, const OrtKernelInfo* /* info */) const{ |
| 28 | return new KernelStringEqual(api); |
| 29 | }; |
| 30 | |
| 31 | const char* CustomOpStringEqual::GetName() const { |
| 32 | return "StringEqual"; |
| 33 | }; |
| 34 | |
| 35 | ONNXTensorElementDataType CustomOpStringEqual::GetInputType(size_t /*index*/) const { |
| 36 | return ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING; |
| 37 | }; |