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 #ifndef TENSORFLOW_C_EAGER_CUSTOM_DEVICE_TESTUTIL_H_ 17 #define TENSORFLOW_C_EAGER_CUSTOM_DEVICE_TESTUTIL_H_ 18 19 // A simple logging device to test custom device registration. 20 #include <memory> 21 22 #include "tensorflow/c/c_api.h" 23 #include "tensorflow/c/eager/c_api.h" 24 #include "tensorflow/c/eager/c_api_experimental.h" 25 #include "tensorflow/c/tf_status.h" 26 27 void RegisterLoggingDevice(TFE_Context* context, const char* name, 28 bool strict_scope_placement, bool* arrived_flag, 29 bool* executed_flag, TF_Status* status); 30 void AllocateLoggingDevice(const char* name, bool* arrived_flag, 31 bool* executed_flag, TFE_CustomDevice** device, 32 void** device_info); 33 TFE_TensorHandle* UnpackTensorHandle(TFE_TensorHandle* logged_tensor_handle, 34 TF_Status* status); 35 36 #endif // TENSORFLOW_C_EAGER_CUSTOM_DEVICE_TESTUTIL_H_ 37