• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2016 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 #ifndef TENSORFLOW_PYTHON_FRAMEWORK_CPP_SHAPE_INFERENCE_H_
17 #define TENSORFLOW_PYTHON_FRAMEWORK_CPP_SHAPE_INFERENCE_H_
18 
19 // Must be included first
20 #include "tensorflow/python/lib/core/numpy.h"
21 
22 #include <vector>
23 #include "tensorflow/c/tf_status_helper.h"
24 #include "tensorflow/core/platform/types.h"
25 
26 namespace tensorflow {
27 namespace swig {
28 
29 // Calls the registered C++ shape inference function for <node> (a serialized
30 // NodeDef).
31 // Should not be called for shape functions that access input tensors; constant
32 // input tensor values are not made available, and so the inferred shapes will
33 // be less precise than they could be.
34 //
35 // Returns an error, or OK, in <out_status> according to whether the shape
36 // inference was successful.
37 //
38 // On success, returns a vector populated with the inferred output shapes (as
39 // serialized CppShapeInferenceResult protos) followed by a serialized
40 // CppShapeInferenceInputsNeeded proto.
41 //
42 // This is temporary code to be used during the migration
43 // from python shape inference functions to C++ shape inference functions.
44 std::vector<string> RunCppShapeInference(
45     int graph_def_version, const string& serialized_node_def,
46     const std::vector<string>& input_serialized_shapes,
47     PyObject* input_constant_tensor_values,
48     const std::vector<string>& input_constant_tensor_as_shape_values,
49     TF_Status* out_status);
50 
51 }  // namespace swig
52 }  // namespace tensorflow
53 
54 #endif  // TENSORFLOW_PYTHON_FRAMEWORK_CPP_SHAPE_INFERENCE_H_
55