• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2019 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 <stdint.h>
17 
18 #include "tensorflow/c/c_api_macros.h"
19 
20 #ifndef TENSORFLOW_C_TF_SHAPE_H_
21 #define TENSORFLOW_C_TF_SHAPE_H_
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 // An opaque type corresponding to a shape in tensorflow. In the future,
28 // we may expose the ABI of TF_Shape for performance reasons.
29 typedef struct TF_Shape TF_Shape;
30 
31 // Return a new, unknown rank shape object. The caller is responsible for
32 // calling TF_DeleteShape to deallocate and destroy the returned shape.
33 TF_CAPI_EXPORT extern TF_Shape* TF_NewShape();
34 
35 // Returns the rank of `shape`. If `shape` has unknown rank, returns -1.
36 TF_CAPI_EXPORT extern int TF_ShapeDims(const TF_Shape* shape);
37 
38 // Returns the `d`th dimension of `shape`. If `shape` has unknown rank,
39 // invoking this function is undefined behavior. Returns -1 if dimension is
40 // unknown.
41 TF_CAPI_EXPORT extern int64_t TF_ShapeDimSize(const TF_Shape* shape, int d);
42 
43 // Deletes `shape`.
44 TF_CAPI_EXPORT extern void TF_DeleteShape(TF_Shape* shape);
45 
46 #ifdef __cplusplus
47 } /* end extern "C" */
48 #endif
49 
50 #endif  // TENSORFLOW_C_TF_SHAPE_H_
51