Viam C++ SDK current
Loading...
Searching...
No Matches
mlmodel.hpp
1// Copyright 2023 Viam Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <vector>
18
19#include <viam/sdk/services/mlmodel.hpp>
20
21namespace viam {
22namespace sdk {
23namespace impl {
24namespace mlmodel {
25
26using tensor_storage_types = boost::mpl::transform_view<MLModelService::base_types,
27 std::vector<boost::mpl::placeholders::_1>>;
28
29using tensor_storage = std::vector<boost::make_variant_over<tensor_storage_types>::type>;
30
31void copy_sdk_tensor_to_api_tensor(const MLModelService::tensor_views& source,
32 ::viam::service::mlmodel::v1::FlatTensor* target);
33
34MLModelService::tensor_views make_sdk_tensor_from_api_tensor(
35 const ::viam::service::mlmodel::v1::FlatTensor& api_tensor, tensor_storage* storage = nullptr);
36
37} // namespace mlmodel
38} // namespace impl
39} // namespace sdk
40} // namespace viam