• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2017 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_LIB_CORE_PY_SEQ_TENSOR_H_
17 #define TENSORFLOW_PYTHON_LIB_CORE_PY_SEQ_TENSOR_H_
18 
19 #include <Python.h>
20 
21 #include "tensorflow/c/eager/c_api_internal.h"
22 #include "tensorflow/core/framework/tensor.h"
23 #include "tensorflow/core/lib/core/status.h"
24 
25 namespace tensorflow {
26 
27 // Converts Python object `obj` representing a rectangular array of
28 // Python values (a scalar, a sequence of scalars, a sequence of
29 // sequences, etc.) into a TFE_TensorHandle.
30 // If dtype is not None it should by a Python integer
31 // representing the desired dtype of the resulting Tensor.
32 // This is used only as a hint, *ret may not have that dtype on
33 // success and may require a cast.
34 //
35 // If an error occurs, this return nullptr and sets the python error indicator
36 // with PyErr_SetString.
37 TFE_TensorHandle* PySeqToTFE_TensorHandle(TFE_Context* ctx, PyObject* obj,
38                                           DataType dtype);
39 
40 }  // namespace tensorflow
41 
42 #endif  // TENSORFLOW_PYTHON_LIB_CORE_PY_SEQ_TENSOR_H_
43