1 | /* Copyright 2016 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_CORE_KERNELS_INPLACE_OPS_FUNCTOR_H_ |
17 | #define TENSORFLOW_CORE_KERNELS_INPLACE_OPS_FUNCTOR_H_ |
18 | |
19 | #include "tensorflow/core/framework/tensor.h" |
20 | #include "tensorflow/core/lib/core/status.h" |
21 | |
22 | namespace tensorflow { |
23 | namespace functor { |
24 | |
25 | template <typename Device> |
26 | Status DoParallelConcat(const Device& device, const Tensor& value, int32_t loc, |
27 | Tensor* output); |
28 | |
29 | // Inplace update/add/sub values in 'y'. It computes |
30 | // y[i, :] = v if op is I_UPDATE |
31 | // y[i, :] += v if op is I_ADD |
32 | // y[i, :] -= v if op is I_SUB |
33 | // Returns an error if the operation fails. |
34 | enum InplaceOpType { |
35 | I_UPDATE, // x = y |
36 | I_ADD, // x += y |
37 | I_SUB, // x -= y |
38 | }; |
39 | template <typename Device> |
40 | Status DoInplace(const Device& device, InplaceOpType op, const Tensor& i, |
41 | const Tensor& v, Tensor* y); |
42 | // Copies x into y. |
43 | template <typename Device> |
44 | Status DoCopy(const Device& device, const Tensor& x, Tensor* y); |
45 | |
46 | } // end namespace functor |
47 | } // end namespace tensorflow |
48 | |
49 | #endif // TENSORFLOW_CORE_KERNELS_INPLACE_OPS_FUNCTOR_H_ |
50 | |