xref: /aosp_15_r20/external/tensorflow/tensorflow/c/experimental/ops/gen/cpp/views/op_view.h (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1 /* Copyright 2021 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 #ifndef TENSORFLOW_C_EXPERIMENTAL_OPS_GEN_CPP_VIEWS_OP_VIEW_H_
16 #define TENSORFLOW_C_EXPERIMENTAL_OPS_GEN_CPP_VIEWS_OP_VIEW_H_
17 
18 #include <vector>
19 
20 #include "tensorflow/c/experimental/ops/gen/cpp/views/arg_view.h"
21 #include "tensorflow/c/experimental/ops/gen/cpp/views/attr_view.h"
22 #include "tensorflow/c/experimental/ops/gen/cpp/views/op_argument_view.h"
23 #include "tensorflow/c/experimental/ops/gen/model/op_spec.h"
24 #include "tensorflow/core/platform/types.h"
25 
26 namespace tensorflow {
27 namespace generator {
28 namespace cpp {
29 
30 class OpView {
31  public:
32   explicit OpView(OpSpec op);
33 
34   const std::vector<ArgView> &Inputs() const;
35   const std::vector<ArgView> &Outputs() const;
36   const std::vector<AttrView> &Attributes() const;
37   const std::vector<OpArgumentView> &AllArguments() const;
38 
39   int NumInputs() const;
40   int NumOutputs() const;
41   ArgView OnlyInput() const;
42   ArgView OnlyOutput() const;
43 
44   string FunctionName() const;
45   string VariableName() const;
46   string OpNameString() const;
47   string Summary() const;
48   std::vector<string> Description() const;
49   bool IsListOp() const;
50 
51  private:
52   OpSpec op_;
53   std::vector<ArgView> input_args_;
54   std::vector<ArgView> output_args_;
55   std::vector<AttrView> argument_attrs_;
56   std::vector<OpArgumentView> all_arguments_;
57 };
58 
59 }  // namespace cpp
60 }  // namespace generator
61 }  // namespace tensorflow
62 
63 #endif  // TENSORFLOW_C_EXPERIMENTAL_OPS_GEN_CPP_VIEWS_OP_VIEW_H_
64