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_COMPILER_XLA_CLIENT_LIB_ARITHMETIC_H_ 17 #define TENSORFLOW_COMPILER_XLA_CLIENT_LIB_ARITHMETIC_H_ 18 19 #include <memory> 20 21 #include "tensorflow/compiler/xla/client/computation.h" 22 #include "tensorflow/compiler/xla/client/computation_builder.h" 23 #include "tensorflow/compiler/xla/xla_data.pb.h" 24 25 namespace xla { 26 27 // Creates a scalar add computation and returns it. 28 Computation CreateScalarAddComputation(PrimitiveType type, 29 ComputationBuilder* builder); 30 31 // Creates a scalar multiply computation and returns it. 32 Computation CreateScalarMultiplyComputation(PrimitiveType type, 33 ComputationBuilder* builder); 34 35 // Creates a scalar ge computation and returns it. 36 Computation CreateScalarGeComputation(PrimitiveType type, 37 ComputationBuilder* builder); 38 39 // Creates a scalar max computation and returns it. 40 Computation CreateScalarMaxComputation(PrimitiveType type, 41 ComputationBuilder* builder); 42 43 // Creates a scalar min computation and returns it. 44 Computation CreateScalarMinComputation(PrimitiveType type, 45 ComputationBuilder* builder); 46 47 // Creates a scalar logical AND computation and returns it. 48 Computation CreateScalarAndComputation(ComputationBuilder* builder); 49 50 // Creates a scalar logical OR computation and returns it. 51 Computation CreateScalarOrComputation(ComputationBuilder* builder); 52 53 // Returns whether any predicate in "predicates" is set. 54 // 55 // Note: if predicates is zero-sized, Any() vacuously returns false. 56 StatusOr<ComputationDataHandle> Any(const ComputationDataHandle& predicates, 57 ComputationBuilder* builder); 58 59 } // namespace xla 60 61 #endif // TENSORFLOW_COMPILER_XLA_CLIENT_LIB_ARITHMETIC_H_ 62