提交 36d01719 编写于 作者: F Frank Chen 提交者: TensorFlower Gardener

Prevent initialization of TPU platform when retrieving it in TransferOps

PiperOrigin-RevId: 327899732
Change-Id: I3888f3bcac86268a18dc957df0e4b197b9867351
上级 6c39bd56
......@@ -69,7 +69,8 @@ void TpuTransferAsyncOpKernel::ComputeAsync(OpKernelContext* ctx,
}
Status TpuTransferAsyncOpKernel::RunTransfer(OpKernelContext* ctx) {
auto* tpu_platform = tpu::TpuPlatformInterface::GetRegisteredPlatform();
auto* tpu_platform = tpu::TpuPlatformInterface::GetRegisteredPlatform(
/*initialize_platform=*/false);
int real_device_ordinal = device_ordinal_;
if (real_device_ordinal < 0) {
......
......@@ -26,7 +26,7 @@ namespace tpu {
namespace {
TpuPlatformInterface* GetRegisteredPlatformStatic(bool initialize_platform,
int tries_left = 3) {
int tries_left = 5) {
if (tries_left <= 0) {
LOG(ERROR) << "Unable to find a TPU platform after exhausting all tries. "
"Returning nullptr...";
......@@ -60,7 +60,7 @@ TpuPlatformInterface* GetRegisteredPlatformStatic(bool initialize_platform,
if (!status_or_other_tpu_platforms.ok() &&
status_or_other_tpu_platforms.status().code() != error::NOT_FOUND) {
LOG(WARNING) << "Error when getting other TPU platforms: "
<< status_or_tpu_platform.status();
<< status_or_other_tpu_platforms.status();
return nullptr;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册