microsoft/onnxruntime-extensions

Public

mirrored from https://github.com/microsoft/onnxruntime-extensionsAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2ef88b0bda3208844b2bee2ea682bc76a4085c63

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

ocos/kernels/kernels.h

27lines · 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
8typedef OrtCustomOp const* CPTR_OrtCustomOp;
9typedef CPTR_OrtCustomOp (*FxGetSchemaInstance)();
10
11FxGetSchemaInstance const* GetCustomOpSchemaList();
12
13struct BaseKernel {
14 BaseKernel(OrtApi api) : api_(api), ort_(api_) { }
15
16 protected:
17 OrtApi api_; // keep a copy of the struct, whose ref is used in the ort_
18 Ort::CustomOpApi ort_;
19};
20
21struct OrtTensorDimensions : std::vector<int64_t> {
22 OrtTensorDimensions(Ort::CustomOpApi& ort, const OrtValue* value) {
23 OrtTensorTypeAndShapeInfo* info = ort.GetTensorTypeAndShape(value);
24 std::vector<int64_t>::operator=(ort.GetTensorShape(info));
25 ort.ReleaseTensorTypeAndShapeInfo(info);
26 }
27};
28