• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2019 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 #include "tensorflow/core/kernels/linalg/einsum_op_impl.h"
17 
18 namespace tensorflow {
19 
20 #define REGISTER_EINSUM(D, TYPE)                                   \
21   REGISTER_KERNEL_BUILDER(                                         \
22       Name("Einsum").Device(DEVICE_##D).TypeConstraint<TYPE>("T"), \
23       EinsumOp<D##Device, TYPE>);
24 
25 #define REGISTER_CPU(TYPE) REGISTER_EINSUM(CPU, TYPE)
26 TF_CALL_complex64(REGISTER_CPU);
27 #undef REGISTER_CPU
28 
29 #if GOOGLE_CUDA || TENSORFLOW_USE_ROCM
30 #define REGISTER_GPU(TYPE) REGISTER_EINSUM(GPU, TYPE)
31 // TODO(rocm): Enable once complex types are supported.
32 #if GOOGLE_CUDA
33 TF_CALL_complex64(REGISTER_GPU);
34 #endif
35 #undef REGISTER_GPU
36 #endif  // GOOGLE_CUDA || TENSORFLOW_USE_ROCM
37 
38 #undef REGISTER_EINSUM
39 
40 }  // namespace tensorflow
41