1 | /* Copyright 2020 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 | #define EIGEN_USE_THREADS |
17 | |
18 | #include "tensorflow/core/kernels/map_kernels.h" |
19 | |
20 | #include "tensorflow/core/framework/op_kernel.h" |
21 | #include "tensorflow/core/framework/types.h" |
22 | #include "tensorflow/core/framework/variant_encode_decode.h" |
23 | |
24 | namespace tensorflow { |
25 | |
26 | REGISTER_KERNEL_BUILDER(Name("EmptyTensorMap" ).Device(DEVICE_CPU), |
27 | EmptyTensorMap); |
28 | |
29 | REGISTER_KERNEL_BUILDER(Name("TensorMapSize" ).Device(DEVICE_CPU), |
30 | TensorMapSize); |
31 | |
32 | REGISTER_KERNEL_BUILDER(Name("TensorMapLookup" ).Device(DEVICE_CPU), |
33 | TensorMapLookup); |
34 | |
35 | REGISTER_KERNEL_BUILDER(Name("TensorMapInsert" ).Device(DEVICE_CPU), |
36 | TensorMapInsert); |
37 | |
38 | REGISTER_KERNEL_BUILDER(Name("TensorMapErase" ).Device(DEVICE_CPU), |
39 | TensorMapErase); |
40 | |
41 | REGISTER_KERNEL_BUILDER(Name("TensorMapHasKey" ).Device(DEVICE_CPU), |
42 | TensorMapHasKey); |
43 | |
44 | REGISTER_KERNEL_BUILDER(Name("TensorMapStackKeys" ).Device(DEVICE_CPU), |
45 | TensorMapStackKeys); |
46 | |
47 | #undef REGISTER_TENSOR_MAP_OPS_CPU |
48 | |
49 | #define REGISTER_TENSOR_MAP_OPS_CPU(T) |
50 | |
51 | REGISTER_UNARY_VARIANT_BINARY_OP_FUNCTION(ADD_VARIANT_BINARY_OP, DEVICE_CPU, |
52 | TensorMap, |
53 | TensorMapBinaryAdd<CPUDevice>); |
54 | |
55 | REGISTER_UNARY_VARIANT_UNARY_OP_FUNCTION(ZEROS_LIKE_VARIANT_UNARY_OP, |
56 | DEVICE_CPU, TensorMap, |
57 | TensorMapZerosLike<CPUDevice>); |
58 | |
59 | } // namespace tensorflow |
60 | |