| 906 | } |
| 907 | |
| 908 | TFE_TensorHandle* TFE_TensorHandleCopyToDevice(TFE_TensorHandle* h, |
| 909 | TFE_Context* ctx, |
| 910 | const char* device_name, |
| 911 | TF_Status* status) { |
| 912 | tensorflow::TensorHandle* handle = nullptr; |
| 913 | tensorflow::Device* device; |
| 914 | status->status = ctx->context->FindDeviceFromName(device_name, &device); |
| 915 | if (!status->status.ok()) { |
| 916 | return nullptr; |
| 917 | } |
| 918 | status->status = tensorflow::EagerCopyToDevice(h->handle, ctx->context, |
| 919 | ctx->context->Executor(), |
| 920 | device, false, &handle); |
| 921 | if (status->status.ok()) { |
| 922 | return new TFE_TensorHandle(handle); |
| 923 | } |
| 924 | return nullptr; |
| 925 | } |
| 926 | |
| 927 | void TFE_ContextAddFunctionDef(TFE_Context* ctx, |
| 928 | const char* serialized_function_def, size_t size, |