TensorFlow Serving C++ API Documentation
tensorflow_serving
core
test_util
session_test_util.h
1
/* Copyright 2019 Google Inc. All Rights Reserved.
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
16
#ifndef TENSORFLOW_SERVING_CORE_TEST_UTIL_SESSION_TEST_UTIL_H_
17
#define TENSORFLOW_SERVING_CORE_TEST_UTIL_SESSION_TEST_UTIL_H_
18
19
#include <functional>
20
21
#include "absl/base/attributes.h"
22
#include "tensorflow/core/lib/core/status.h"
23
#include "tensorflow/core/public/session_options.h"
24
25
namespace
tensorflow {
26
namespace
serving {
27
namespace
test_util {
28
29
// Sets a 'hook' function, which will be called when a new session is created
30
// via the tensorflow::NewSession() API. If the hook returns an error status,
31
// the session creation fails.
32
//
33
// For this hook to be enabled, create a session by setting
34
// SessionOptions::target as "new_session_hook/<actual_session_target>". This
35
// will call the hook as well as return the session created when target is
36
// "<actual_session_target>".
37
//
38
// Calling this method again replaces the previous hook.
39
//
40
// This method is NOT thread-safe.
41
ABSL_CONST_INIT
extern
const
char
kNewSessionHookSessionTargetPrefix[];
42
void
SetNewSessionHook(std::function<Status(
const
SessionOptions&)> hook);
43
44
}
// namespace test_util
45
}
// namespace serving
46
}
// namespace tensorflow
47
48
#endif
// TENSORFLOW_SERVING_CORE_TEST_UTIL_SESSION_TEST_UTIL_H_
Generated by
1.9.1