1/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations 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
22namespace tensorflow {
23namespace functor {
24
25template <typename Device>
26Status 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.
34enum InplaceOpType {
35 I_UPDATE, // x = y
36 I_ADD, // x += y
37 I_SUB, // x -= y
38};
39template <typename Device>
40Status DoInplace(const Device& device, InplaceOpType op, const Tensor& i,
41 const Tensor& v, Tensor* y);
42// Copies x into y.
43template <typename Device>
44Status 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