• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2018 The TensorFlow Authors. 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 #include "tensorflow/compiler/tf2tensorrt/plugin/trt_plugin_utils.h"
17 #include <cassert>
18 
19 #if GOOGLE_CUDA
20 #if GOOGLE_TENSORRT
21 
22 namespace tensorflow {
23 namespace tensorrt {
24 
ExtractOpName(const void * serial_data,size_t serial_length,size_t * incremental)25 string ExtractOpName(const void* serial_data, size_t serial_length,
26                      size_t* incremental) {
27   size_t op_name_char_count = *static_cast<const size_t*>(serial_data);
28   *incremental = sizeof(size_t) + op_name_char_count;
29 
30   assert(serial_length >= *incremental);
31 
32   const char* buffer = static_cast<const char*>(serial_data) + sizeof(size_t);
33   string op_name(buffer, op_name_char_count);
34 
35   return op_name;
36 }
37 
38 }  // namespace tensorrt
39 }  // namespace tensorflow
40 
41 #endif  // GOOGLE_CUDA
42 #endif  // GOOGLE_TENSORRT
43