| 902 | } // namespace |
| 903 | |
| 904 | Status EagerExecute(EagerOperation* op, |
| 905 | gtl::InlinedVector<TensorHandle*, 2>* retvals, |
| 906 | int* num_retvals) { |
| 907 | profiler::TraceMe activity( |
| 908 | [&] { return absl::StrCat("EagerExecute: ", op->Name()); }, |
| 909 | profiler::TraceMeLevel::kInfo); |
| 910 | TF_RETURN_IF_ERROR(MaybeUpdateOpDevice(op)); |
| 911 | |
| 912 | bool op_is_local = op->EagerContext()->IsLocalDeviceName(op->GetDeviceName()); |
| 913 | |
| 914 | std::unique_ptr<tensorflow::EagerOperation> out_op; |
| 915 | TF_RETURN_IF_ERROR(EagerOpRewriteRegistry::Global()->RunRewrite( |
| 916 | EagerOpRewriteRegistry::PRE_EXECUTION, op, &out_op)); |
| 917 | |
| 918 | if (op_is_local) { |
| 919 | if (out_op) { |
| 920 | op = out_op.get(); |
| 921 | } |
| 922 | return EagerLocalExecute(op, retvals->data(), num_retvals); |
| 923 | } |
| 924 | |
| 925 | if (op->EagerContext()->LogDevicePlacement() || VLOG_IS_ON(1)) { |
| 926 | string msg = strings::StrCat( |
| 927 | "Executing op ", op->Name(), " on task ", |
| 928 | DeviceNameUtils::ParsedNameToString(op->GetDeviceName())); |
| 929 | if (!logging::LogToListeners(msg)) { |
| 930 | LOG(INFO) << msg; |
| 931 | } |
| 932 | } |
| 933 | |
| 934 | #if defined(IS_MOBILE_PLATFORM) |
| 935 | return errors::Unimplemented( |
| 936 | "Eager's remote execution is not available on mobile devices."); |
| 937 | #else // !IS_MOBILE_PLATFORM |
| 938 | if (out_op) { |
| 939 | op = out_op.get(); |
| 940 | } |
| 941 | return EagerRemoteExecute(op, retvals->data(), num_retvals); |
| 942 | #endif // !IS_MOBILE_PLATFORM |
| 943 | } |
| 944 | |
| 945 | // TODO(gjn): Consider moving into ExecuteNode class |
| 946 | Status EagerKernelExecute(EagerContext* ctx, |
no test coverage detected