-
Notifications
You must be signed in to change notification settings - Fork 214
/
Copy pathget_model_metadata_impl.hpp
78 lines (65 loc) · 2.79 KB
/
get_model_metadata_impl.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//*****************************************************************************
// Copyright 2020 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#pragma once
#include <map>
#include <memory>
#include <string>
#pragma warning(push)
#pragma warning(disable : 4624 6001 6385 6386 6326 6011 4457 6308 6387 6246)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow_serving/apis/prediction_service.grpc.pb.h"
#pragma GCC diagnostic pop
#pragma warning(pop)
#include "tensorinfo.hpp"
namespace ovms {
using proto_signature_map_t = google::protobuf::Map<std::string, tensorflow::TensorInfo>;
struct ExecutionContext;
class ModelInstance;
class ModelManager;
class PipelineDefinition;
class Server;
class Status;
class GetModelMetadataImpl {
ModelManager& modelManager;
public:
GetModelMetadataImpl(ovms::Server& ovmsServer);
static Status validate(
const tensorflow::serving::GetModelMetadataRequest* request);
static void convert(
const tensor_map_t& from,
proto_signature_map_t* to);
static Status buildResponse(
std::shared_ptr<ModelInstance> instance,
tensorflow::serving::GetModelMetadataResponse* response);
static Status buildResponse(
PipelineDefinition& pipelineDefinition,
tensorflow::serving::GetModelMetadataResponse* response,
const ModelManager& manager);
Status getModelStatus(
const tensorflow::serving::GetModelMetadataRequest* request,
tensorflow::serving::GetModelMetadataResponse* response, ExecutionContext context) const;
static Status getModelStatus(
const tensorflow::serving::GetModelMetadataRequest* request,
tensorflow::serving::GetModelMetadataResponse* response,
ModelManager& manager,
ExecutionContext context);
static Status createGrpcRequest(const std::string& model_name, std::optional<int64_t> model_version, tensorflow::serving::GetModelMetadataRequest* request);
static Status serializeResponse2Json(const tensorflow::serving::GetModelMetadataResponse* response, std::string* output);
};
} // namespace ovms