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 #include "tensorflow/c/experimental/ops/gen/cpp/views/arg_view.h" 16 17 namespace tensorflow { 18 namespace generator { 19 namespace cpp { 20 ArgView(ArgSpec arg)21ArgView::ArgView(ArgSpec arg) : arg_(arg) {} 22 VariableName() const23string ArgView::VariableName() const { return arg_.name(); } 24 SetterMethod() const25string ArgView::SetterMethod() const { 26 if (IsList()) { 27 return "AddInputList"; 28 } else { 29 return "AddInput"; 30 } 31 } 32 SetterArgs() const33std::vector<string> ArgView::SetterArgs() const { return {VariableName()}; } 34 IsList() const35bool ArgView::IsList() const { return arg_.arg_type().is_list(); } 36 Position() const37int ArgView::Position() const { return arg_.position(); } 38 39 } // namespace cpp 40 } // namespace generator 41 } // namespace tensorflow 42