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/api/service/mlmodel/v1/mlmodel.grpc.pb.h>
20
21#include <viam/sdk/services/mlmodel.hpp>
22
23namespace viam {
24namespace sdk {
25namespace impl {
26namespace mlmodel {
27
28using tensor_storage_types = boost::mpl::transform_view<MLModelService::base_types,
29 std::vector<boost::mpl::placeholders::_1>>;
30
31using tensor_storage = std::vector<boost::make_variant_over<tensor_storage_types>::type>;
32
33void copy_sdk_tensor_to_api_tensor(const MLModelService::tensor_views& source,
34 ::viam::service::mlmodel::v1::FlatTensor* target);
35
36MLModelService::tensor_views make_sdk_tensor_from_api_tensor(
37 const ::viam::service::mlmodel::v1::FlatTensor& api_tensor, tensor_storage* storage = nullptr);
38
39} // namespace mlmodel
40} // namespace impl
41} // namespace sdk
42} // namespace viam