• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2018 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_DISTRIBUTED_RUNTIME_EAGER_REMOTE_TENSOR_HANDLE_H_
17 #define TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_EAGER_REMOTE_TENSOR_HANDLE_H_
18 
19 #include "tensorflow/core/platform/fingerprint.h"
20 #include "tensorflow/core/protobuf/remote_tensor_handle.pb.h"
21 
22 namespace tensorflow {
23 namespace eager {
24 
25 struct RemoteTensorHandleInternal {
RemoteTensorHandleInternalRemoteTensorHandleInternal26   explicit RemoteTensorHandleInternal(const RemoteTensorHandle& tensor_handle)
27       : op_id(tensor_handle.op_id()), output_num(tensor_handle.output_num()) {}
RemoteTensorHandleInternalRemoteTensorHandleInternal28   RemoteTensorHandleInternal(int64 op_id, int32 output_num)
29       : op_id(op_id), output_num(output_num) {}
30   int64 op_id;
31   int32 output_num;
32 };
33 
34 struct RemoteTensorHandleInternalHash {
operatorRemoteTensorHandleInternalHash35   std::size_t operator()(const RemoteTensorHandleInternal& handle) const {
36     return FingerprintCat64(handle.op_id, handle.output_num);
37   }
38 };
39 
40 struct RemoteTensorHandleInternalEquals {
operatorRemoteTensorHandleInternalEquals41   bool operator()(const RemoteTensorHandleInternal& first,
42                   const RemoteTensorHandleInternal& second) const {
43     return first.op_id == second.op_id && first.output_num == second.output_num;
44   }
45 };
46 
47 }  // namespace eager
48 }  // namespace tensorflow
49 
50 #endif  // TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_EAGER_REMOTE_TENSOR_HANDLE_H_
51