CVE-2023-25658 (C++, published 2023-03-25T00:15Z)
Description: value: TensorFlow is an open source platform for machine learning. Prior to versions 2.12.0 and 2.11.1, an out of bounds read is in GRUBlockCellGrad. A fix is included in TensorFlow 2.12.0 and 2.11.1.

Severity: nan (CVSS v3 base score: 7.5)
Weakness: CWE-125 \u2014 Out-of-bounds Read
The product reads data past the end, or before the beginning, of the intended buffer.
Repository: https://github.com/tensorflow/tensorflow
Files changed:
.bazelrc
tensorflow/compiler/jit/BUILD
tensorflow/compiler/xla/backends/interpreter/BUILD
tensorflow/compiler/xla/backends/interpreter/platform.cc
tensorflow/compiler/xla/hlo/evaluator/hlo_evaluator.cc
tensorflow/compiler/xla/mlir/tools/mlir_replay/BUILD
tensorflow/compiler/xla/service/hlo_graph_dumper.cc
tensorflow/compiler/xla/stream_executor/BUILD
tensorflow/compiler/xla/stream_executor/cuda/cuda_blas.cc
tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc
tensorflow/compiler/xla/stream_executor/cuda/cuda_driver.cc
tensorflow/compiler/xla/stream_executor/cuda/cuda_fft.cc
tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc
tensorflow/compiler/xla/stream_executor/cuda/cuda_platform.cc
tensorflow/compiler/xla/stream_executor/cuda/cuda_rng.cc
tensorflow/compiler/xla/stream_executor/host/BUILD
tensorflow/compiler/xla/stream_executor/host/host_gpu_executor.h
tensorflow/compiler/xla/stream_executor/host/host_platform.cc
tensorflow/compiler/xla/stream_executor/lib/BUILD
tensorflow/compiler/xla/stream_executor/multi_platform_manager.cc
tensorflow/compiler/xla/stream_executor/multi_platform_manager.h
tensorflow/compiler/xla/stream_executor/platform.cc
tensorflow/compiler/xla/stream_executor/plugin_registry.cc
tensorflow/compiler/xla/stream_executor/rocm/rocm_blas.cc
tensorflow/compiler/xla/stream_executor/rocm/rocm_diagnostics.cc
tensorflow/compiler/xla/stream_executor/rocm/rocm_dnn.cc
tensorflow/compiler/xla/stream_executor/rocm/rocm_driver.cc
tensorflow/compiler/xla/stream_executor/rocm/rocm_fft.cc
tensorflow/compiler/xla/stream_executor/rocm/rocm_gpu_executor.cc
tensorflow/compiler/xla/stream_executor/rocm/rocm_platform.cc
tensorflow/compiler/xla/stream_executor/rocm/rocm_rng.cc
tensorflow/compiler/xla/stream_executor/stream_executor_pimpl.cc
tensorflow/compiler/xla/stream_executor/tf_allocator_adapter.cc
tensorflow/core/common_runtime/function.cc
tensorflow/core/data/BUILD
tensorflow/core/data/service/server_lib.cc
tensorflow/core/data/service/server_lib.h
tensorflow/core/data/service/snapshot/BUILD
tensorflow/core/data/service/snapshot/path_utils.cc
tensorflow/core/data/service/snapshot/path_utils.h
tensorflow/core/data/service/snapshot/path_utils_test.cc
tensorflow/core/data/service/snapshot/snapshot_manager.cc
tensorflow/core/data/tfdataz_metrics.cc
tensorflow/core/data/tfdataz_metrics.h
tensorflow/core/data/tfdataz_metrics_test.cc
tensorflow/core/distributed_runtime/eager/remote_mgr.cc
tensorflow/core/distributed_runtime/integration_test/coordination_test_opkernel_registration.cc
tensorflow/core/framework/dataset.h
tensorflow/core/framework/op_requires.h
tensorflow/core/kernels/data/iterator_ops.cc
tensorflow/core/kernels/function_ops.cc
tensorflow/core/kernels/functional_ops.cc
tensorflow/core/kernels/rnn/gru_ops.cc
tensorflow/core/lib/core/status_test.cc
tensorflow/core/platform/error_payloads.cc
tensorflow/core/tpu/kernels/tpu_compile_op_common.cc
tensorflow/core/tpu/kernels/tpu_functional_ops.cc
tensorflow/core/tpu/tpu_embedding_errors.cc
tensorflow/core/tpu/tpu_embedding_errors.h
tensorflow/core/util/zen_util.h
tensorflow/lite/delegates/xnnpack/README.md
tensorflow/python/data/experimental/kernel_tests/service/snapshot_ft_test.py
tensorflow/python/framework/BUILD
tensorflow/python/framework/errors_test_helper.cc
tensorflow/python/tpu/tpu_strategy_util.py
tensorflow/tools/ci_build/release/requirements_common.txt
tensorflow/tools/ci_build/release/requirements_mac.txt
tensorflow/tools/tf_sig_build_dockerfiles/devel.requirements.txt
tensorflow/tsl/c/tsl_status.cc
tensorflow/tsl/c/tsl_status_helper_test.cc
tensorflow/tsl/distributed_runtime/coordination/coordination_service_error_util.h
tensorflow/tsl/distributed_runtime/rpc/grpc_util.h
tensorflow/tsl/distributed_runtime/rpc/grpc_util_test.cc
tensorflow/tsl/platform/errors.h
tensorflow/tsl/platform/test.h
tensorflow/tsl/profiler/lib/BUILD
tensorflow/tsl/profiler/lib/traceme_encode.h
tensorflow/tsl/profiler/lib/traceme_encode_test.cc
third_party/tf_runtime/workspace.bzl
Commit message: Merged commit includes the following changes:
504684855  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Remove legacy references from `ops.py`.

    This is done to eventually remove the lazy loads in `indexed_slices.py`.

--
504682660  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Add missing reference symbol.

--
504682467  by A. Unique TensorFlower<gardener@tensorflow.org>:

    #tf-data-service Add a function to parse split file names.

--
504680829  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Update XNNPACK README to document feature parity for FP16 operators

--
504677404  by A. Unique TensorFlower<gardener@tensorflow.org>:
    Automated rollback of changelist 504103068.

504676634  by A. Unique TensorFlower<gardener@tensorflow.org>:
    Automated rollback of changelist 504656381.

504672100  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Delete compiler/xla/stream_executor/lib/initialize.h, update users to depend on stream_executor/platform/intialize.h directly

--
504669543  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Refactor transforms to make buildozer object injectable.

--
504667726  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Update all CI dependencies to non vulnerable versions.

    This MUST land before branch cut.

--
504661218  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Update TFRT dependency to use revision
    http://github.com/tensorflow/runtime/commit/c653281a1a23c0c3d41536a983c7d10fcc5b1fbf.

--
504660212  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Change TraceMeArg to keep a reference to an AlphaNum constructed on the stack rather than constructing it by value.

    The eliminates a lifetime safety bug where AlphaNum uses a default constructed argument as a string buffer that was a dangling reference before.

    Also add a LIFETIME_BOUND attribute to ensure this is used correctly.

--
504660069  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Add kIsOpenSource to tsl/platform/test.h

--
504659330  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Update usages of tensorflow::Status::SetPayload.

--
504656381  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Remove the scrubbing of constants in tpu_cluster_formation.

    Instead, just ignore tf.Const attributes, in CollectAndGroupClusterOps. This
    is functionally equivalent (for this pass), but a bit more clean since it
    doesn't leave modified tf.Const ops behind.

--
504654874  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Add missing dependency for the Mac build.

--
504653641  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Internal visibility change

--
504648821  by A. Unique TensorFlower<gardener@tensorflow.org>:
    Automated rollback of changelist 504006190.
BEGIN_PUBLIC
Rollback of PR #59418: [aarch64] enable acl linking for cpu xla for mkl_aarch64_threadpool config
Reason: The configuration is still not very well-tested.
END_PUBLIC

504645490  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Fix input validation for GRU ops.

--
504633571  by A. Unique TensorFlower<gardener@tensorflow.org>:

    [SE] Replace uses of stream_executor::port::error with tsl::error.

    This lets us remove stream_executor/lib/error.h!

    No functional change; these are aliases of one another.

--
504633188  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Update tf.tpu.experimental.initialize_tpu_system to disable running on eager mode.

--
504618714  by A. Unique TensorFlower<gardener@tensorflow.org>:

    [XLA:GPU] Update hlo graph dumper to additionally dump the gemm epilogue from the GemmBackendConfig

--
504618661  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Fix ODR violation from zen_util.h

--
504616623  by A. Unique TensorFlower<gardener@tensorflow.org>:

    [tf.data] Collect the iterator's memory usage metrics for /tfdataz page.

--
504612989  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Internal change

PiperOrigin-RevId: 504684855


Vulnerable code:
build:mkl_aarch64_threadpool --define=build_with_acl=true
        "//tensorflow/compiler/xla/stream_executor/lib",
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
  error.SetPayload(kEvalErrorDetailUrl, error_payload);
        "//tensorflow/compiler/xla/stream_executor/lib",
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
      return tsl::Status(port::error::UNKNOWN, oss.str());              \
      return tsl::Status(port::error::UNKNOWN, oss.str());              \
      return tsl::Status(port::error::INTERNAL, error);
  return tsl::Status(port::error::INTERNAL,
      return tsl::Status(port::error::INVALID_ARGUMENT,
      return tsl::Status(port::error::INVALID_ARGUMENT, "max_seq_length <= 0");
      return tsl::Status(port::error::INVALID_ARGUMENT, "max_seq_length <= 0");
    return tsl::Status(port::error::INVALID_ARGUMENT, "Invalid input_h shape");
    return tsl::Status(port::error::INVALID_ARGUMENT, "Invalid input_c shape");
    return tsl::Status(port::error::INVALID_ARGUMENT, "Invalid output shape");
    return tsl::Status(port::error::INVALID_ARGUMENT, "Invalid output_h shape");
    return tsl::Status(port::error::INVALID_ARGUMENT, "Invalid output_c shape");
    return tsl::Status(port::error::INVALID_ARGUMENT,
        return tsl::Status(port::error::INTERNAL, "Failed to start timer");
        return tsl::Status(port::error::INTERNAL, "Failed to stop timer");
      return tsl::Status(port::error::INTERNAL, "Failed to start timer");
      return tsl::Status(port::error::INTERNAL, "Failed to stop timer");
        return tsl::Status(port::error::INTERNAL, "Failed to start timer");
        return tsl::Status(port::error::INTERNAL, "Failed to stop timer");
      return tsl::Status(port::error::INTERNAL, "Failed to start timer");
      return tsl::Status(port::error::INTERNAL, "Failed to stop timer");
  return tsl::Status(port::error::INVALID_ARGUMENT,
  return tsl::Status(port::error::INTERNAL,
  return tsl::Status(port::error::INTERNAL,
  return tsl::Status(port::error::INTERNAL,
        port::error::INTERNAL,
        port::error::INTERNAL,
    return tsl::Status(port::error::INVALID_ARGUMENT,
        port::error::INTERNAL,
        port::error::INTERNAL,
    return tsl::Status(port::error::INVALID_ARGUMENT,
        port::error::INTERNAL,
        port::error::INTERNAL,
    return tsl::Status(port::error::INVALID_ARGUMENT,
      return tsl::Status(port::error::INVALID_ARGUMENT,
        port::error::INVALID_ARGUMENT,
        port::error::INVALID_ARGUMENT,
        return tsl::Status(port::error::INTERNAL, "Failed to start timer");
            port::error::FAILED_PRECONDITION,
        return tsl::Status(port::error::INTERNAL, "Failed to stop timer");
        return tsl::Status(port::error::INTERNAL, "Failed to start timer");
        return tsl::Status(port::error::INTERNAL, "Failed to stop timer");
          port::error::UNKNOWN,
        return tsl::Status(port::error::INTERNAL, "Failed to start timer");
      return tsl::Status(port::error::FAILED_PRECONDITION,
        return tsl::Status(port::error::INTERNAL, "Failed to stop timer");
    return tsl::Status(port::error::INVALID_ARGUMENT,
      return tsl::Status(port::error::UNKNOWN,
    return tsl::Status(port::error::INTERNAL,
    return tsl::Status(port::error::INTERNAL,
          port::error::INTERNAL,
    return tsl::Status(port::error::INVALID_ARGUMENT,
  return tsl::Status(port::error::INVALID_ARGUMENT,
    return tsl::Status(port::error::INVALID_ARGUMENT,
        port::error::INTERNAL,
    return tsl::Status(port::error::INTERNAL, "Cudnn pooling failed to split");
    return tsl::Status(port::error::INTERNAL, "Cudnn pooling failed to split");
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
  return tsl::Status(port::error::ABORTED,
  return tsl::Status(port::error::INTERNAL, message);
      port::error::INTERNAL,
    return tsl::Status(port::error::INVALID_ARGUMENT,
        port::error::INTERNAL,
    return tsl::Status(port::error::RESOURCE_EXHAUSTED,
        port::error::FAILED_PRECONDITION,
          port::error::UNAVAILABLE,
      port::error::INTERNAL,
            port::error::INTERNAL,
      port::error::INTERNAL,
        port::error::NOT_FOUND,
      port::error::INTERNAL,
        port::error::INTERNAL,
        port::error::INTERNAL,
      port::error::INTERNAL,
      port::error::INTERNAL,
        port::error::INTERNAL,
        port::error::INTERNAL,
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
        port::error::INTERNAL,
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
      port::error::NOT_FOUND,
        port::error::INTERNAL,
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
        "@com_google_absl//absl/base:core_headers",
        "//tensorflow/compiler/xla/stream_executor:stream_executor_pimpl",
        "//tensorflow/compiler/xla/stream_executor:timer",
        "//tensorflow/compiler/xla/stream_executor/lib",
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
        port::error::INTERNAL,
        "//tensorflow/compiler/xla/stream_executor/platform",
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/


#ifndef TENSORFLOW_COMPILER_XLA_STREAM_EXECUTOR_LIB_ERROR_H_
#define TENSORFLOW_COMPILER_XLA_STREAM_EXECUTOR_LIB_ERROR_H_

#include "tensorflow/tsl/protobuf/error_codes.pb.h"  // IWYU pragma: export

namespace stream_executor {
namespace port {

namespace error = tensorflow::error;

}  // namespace port
}  // namespace stream_executor

#endif  // TENSORFLOW_COMPILER_XLA_STREAM_EXECUTOR_LIB_ERROR_H_
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef TENSORFLOW_COMPILER_XLA_STREAM_EXECUTOR_LIB_INITIALIZE_H_
#define TENSORFLOW_COMPILER_XLA_STREAM_EXECUTOR_LIB_INITIALIZE_H_

#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"

#endif  // TENSORFLOW_COMPILER_XLA_STREAM_EXECUTOR_LIB_INITIALIZE_H_
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
    return tsl::Status(port::error::INTERNAL,
        port::error::FAILED_PRECONDITION,
        port::error::FAILED_PRECONDITION,
        port::error::NOT_FOUND,
        port::error::NOT_FOUND,
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
    return tsl::Status(port::error::UNIMPLEMENTED,
  return tsl::Status(port::error::UNIMPLEMENTED,
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
        port::error::ALREADY_EXISTS,
          port::error::NOT_FOUND,
            port::error::FAILED_PRECONDITION,                                 \
      return tsl::Status(port::error::FAILED_PRECONDITION,                    \
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/lib/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
    return tsl::Status(port::error::UNKNOWN,
    return tsl::Status(port::error::UNKNOWN,
    return tsl::Status(port::error::UNKNOWN,
    return tsl::Status(port::error::UNKNOWN,
      port::error::NOT_FOUND,
        port::error::INTERNAL,
        port::error::INTERNAL,
#include "tensorflow/compiler/xla/stream_executor/lib/error.h"
    FunctionLibraryRuntime::Options opts;
    int port, const std::string& protocol, const std::string server_type,
      const std::string server_type,
    std::vector<std::string> tokens = absl::StrSplit(split_filename, '_');
    int64_t local_split_index;
    int64_t global_split_index;
    if (tokens.size() != 3 ||
        !absl::SimpleAtoi(tokens[1], &local_split_index) ||
        local_split_index < 0 ||
        !absl::SimpleAtoi(tokens[2], &global_split_index) ||
        global_split_index < 0) {
      return InvalidArgument("can't parse the name of ", split_path);
    }
    if (local_split_index > global_split_index) {
      return InvalidArgument(
          "found conflict between local split index and global split index in ",
          "name of ", split_path);
    }
TfDatazMetricsCollector::TfDatazMetricsCollector(const Env& env)
    : latency_estimator_(env) {}
  explicit TfDatazMetricsCollector(const Env& env);
#include "tensorflow/core/framework/types.h"
    tfdataz_metrics_ = std::make_unique<TfDatazMetricsCollector>(*env_);
  auto collector_one =
      std::make_shared<TfDatazMetricsCollector>(*Env::Default());
  auto collector_two =
      std::make_shared<TfDatazMetricsCollector>(*Env::Default());
  auto collector_one =
      std::make_shared<TfDatazMetricsCollector>(*Env::Default());
  auto collector_two =
      std::make_shared<TfDatazMetricsCollector>(*Env::Default());
  auto collector_three =
      std::make_shared<TfDatazMetricsCollector>(*Env::Default());
                   error_source_proto.SerializeAsString());
    s.SetPayload(tsl::CoordinationErrorPayloadKey(), "testing error payload");
        STATUS.SetPayload(PAYLOAD_KEY, PAYLOAD_VALUE);                         \
  tf_dataz_metrics_collector_ = std::make_shared<TfDatazMetricsCollector>(*env);
  TfDatazMetricsRegistry::Register(tf_dataz_metrics_collector_);
    FunctionLibraryRuntime::Options opts;
          lib_(CHECK_NOTNULL(ctx_->function_library())) {
          lib_(CHECK_NOTNULL(ctx_->function_library())) {
          lib_(CHECK_NOTNULL(ctx_->function_library())) {
    const int64_t cell_size = h_prev_tensor->dim_size(1);

    // Sanity checks for input shapes.
    OP_REQUIRES(ctx, h_prev_tensor->dim_size(1) == cell_size,
                errors::InvalidArgument(
                    "h_prev.dims(1) != cell_size: ", h_prev_tensor->dim_size(1),
                    " vs. ", cell_size));


    OP_REQUIRES(ctx, b_ru_tensor->dims() == 1,
                errors::InvalidArgument("Rank of b_ru must be 1",
                                        b_ru_tensor->dims(), " vs. 1", 1));
    OP_REQUIRES(ctx, b_c_tensor->dims() == 1,
                errors::InvalidArgument("Rank of b_c must be 1",
                                        b_c_tensor->dims(), " vs. 1"));
    const int64_t cell_size = h_prev_tensor->dim_size(1);
    // Sanity checks for input shapes.

    // Shape of 'h_prev' must be [batch_size, cell_size]
    OP_REQUIRES(ctx, h_prev_tensor->dim_size(1) == cell_size,
                errors::InvalidArgument(
                    "h_prev.dims(1) != cell_size: ", h_prev_tensor->dim_size(1),
                    " vs. ", cell_size));


    OP_REQUIRES(ctx, b_ru_tensor->dims() == 1,
                errors::InvalidArgument("Rank of b_ru must be 1",
                                        b_ru_tensor->dims(), " vs. 1"));

    OP_REQUIRES(ctx, b_c_tensor->dims() == 1,
                errors::InvalidArgument("Rank of b_c must be 1 ",
                                        b_c_tensor->dims(), " vs. 1"));

  s.SetPayload("Invalid", "Invalid Val");
  s.SetPayload("Error key", "Original");
  s.SetPayload("Error key", "Updated");
  s.SetPayload("Error key", "Original");
                      error_source_proto.SerializeAsString());
                      output.scalar<tstring>()());
  FunctionLibraryRuntime::Options opts;
  FunctionLibraryRuntime::Options opts;
  FunctionLibraryRuntime::Options opts;
    status.SetPayload(kTpuEmbeddingErrorUrl, error_payload.SerializeAsString());
    status.SetPayload(kTpuEmbeddingErrorUrl, error_payload.SerializeAsString());
int64_t GetMempool() {
bool IsBlockedFormatEnabled() {
### Floating-Point (IEEE FP16) Operators (experimental)
format. Currently, this hardware is limited to ARM64 devices with ARMv8.2 FP16
arithmetics extension, and includes Android phones starting with Pixel 3,
Galaxy S9 (Snapdragon SoC), Galaxy S10 (Exynos SoC), iOS devices with A11 or
newer SoCs, and all Apple Silicon Macs.
is compatible with FP16 inference.
converted to FP16 and back to FP32. Note that such simulation is not exactly
Below is the list of operators supported in IEEE FP16 inference:

#### `ABS`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `ADD`

* Must satisfy constraints on the floating-point (FP32) operator.
* Neither of the inputs can be static (use `kTfLiteMmapRo` allocation type).

#### `AVERAGE_POOL_2D`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `CEIL`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `CONV_2D`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `CONCATENATION`

* Must satisfy constraints on the floating-point (FP32) operator.
* Neither of the inputs can be static (use `kTfLiteMmapRo` allocation type).

#### `DEPTH_TO_SPACE`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `DEPTHWISE_CONV_2D`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `DIV`

* Must satisfy constraints on the floating-point (FP32) operator.
* Neither of the inputs can be static (use `kTfLiteMmapRo` allocation type).

#### `FLOOR`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `FULLY_CONNECTED`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `HARD_SWISH`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `LEAKY_RELU`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `LOGISTIC`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `MAX_POOL_2D`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `MAXIMUM`

* Must satisfy constraints on the floating-point (FP32) operator.
* Neither of the inputs can be static (use `kTfLiteMmapRo` allocation type).

#### `MEAN`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `MINIMUM`

* Must satisfy constraints on the floating-point (FP32) operator.
* Neither of the inputs can be static (use `kTfLiteMmapRo` allocation type).

#### `MUL`

* Must satisfy constraints on the floating-point (FP32) operator.
* Neither of the inputs can be static (use `kTfLiteMmapRo` allocation type).

#### `NEG`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `PAD`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `PRELU`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `RELU`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `RELU6`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `RELU_N1_TO_1`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `RESHAPE`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `RESIZE_BILINEAR`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `ROUND`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `SLICE`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `SOFTMAX`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `SPACE_TO_DEPTH`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `SPLIT`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `SQRT`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `SQUARE`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `SQUARED_DIFFERENCE`

* Must satisfy constraints on the floating-point (FP32) operator.
* Neither of the inputs can be static (use `kTfLiteMmapRo` allocation type).

#### `STRIDED_SLICE`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `SUB`

* Must satisfy constraints on the floating-point (FP32) operator.
* Neither of the inputs can be static (use `kTfLiteMmapRo` allocation type).

#### `TRANSPOSE`

* Must satisfy constraints on the floating-point (FP32) operator.

#### `TRANSPOSE_CONV`

* Must satisfy constraints on the floating-point (FP32) operator.
inference is restricted to subgraphs with the following operators:
    with self.assertRaisesRegex(ValueError, "can't parse"):
    with self.assertRaisesRegex(ValueError, "found conflict"):
    status.SetPayload("key1", "value1");
    status.SetPayload("key2", "value2");

    with ops.device(tpu._tpu_system_device_name(job)):  # pylint: disable=protected-access
      _tpu_shutdown_fn()
numpy ~= 1.21.4; python_version < '3.11'
wheel ~= 0.36.2
packaging
certifi ~= 2020.12.5
numpy ~= 1.21.4; python_version < '3.11'
wheel ~= 0.36.2
pylint ~= 2.13.9
  s->status.SetPayload(key, value);
  cc_status.SetPayload("key1", "value1");
  cc_status.SetPayload("key2", "value2");
  s.SetPayload(CoordinationErrorPayloadKey(), "");
  s.SetPayload(CoordinationErrorPayloadKey(), error.SerializeAsString());
  s.SetPayload(CoordinationErrorPayloadKey(), payload.SerializeAsString());
      s.SetPayload(key_val.first, key_val.second);
                 tensorflow::distributed_runtime::GrpcPayloadsLost()
                     .SerializeAsString());
  status.SetPayload("a", "\\xFF\\x02\\x03");
    status.SetPayload(payload.first, payload.second);
    to.SetPayload(key, value);
  // This constructor is required because absl::AlphaNum is non-copyable.
  template <typename Value>
  TraceMeArg(absl::string_view k, Value v) : key(k), value(v) {}
  absl::AlphaNum value;
      out = Append(out, arg.value.Piece());
    TFRT_COMMIT = "c1248a015d23949afa2471bb21f6f52850aead7d"
    TFRT_SHA256 = "8cdd8ea905478ac4ffd36ffb39cebe288d3b840d71a02d418bc6a8a760f92af8"

Fixed code:
        "//learning/brain/tfrt/tpu_plugin:__pkg__",
        "//tensorflow/compiler/xla/stream_executor/platform",
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
  error.SetPayload(kEvalErrorDetailUrl, absl::Cord(error_payload));
        "//tensorflow/compiler/xla/mlir/tools/mlir_replay/public:compiler_trace_proto_cc_impl",
  if (config.epilogue() != gpu::GemmBackendConfig::DEFAULT) {
    props.emplace_back(
        "epilogue", gpu::GemmBackendConfig::Epilogue_Name(config.epilogue()));
  }
        "//tensorflow/tsl/platform:errors",
        "//tensorflow/tsl/platform:errors",
        "//tensorflow/tsl/platform:errors",
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
      return tsl::Status(tsl::error::UNKNOWN, oss.str());               \
      return tsl::Status(tsl::error::UNKNOWN, oss.str());               \
      return tsl::Status(tsl::error::INTERNAL, error);
  return tsl::Status(tsl::error::INTERNAL,
      return tsl::Status(tsl::error::INVALID_ARGUMENT,
      return tsl::Status(tsl::error::INVALID_ARGUMENT, "max_seq_length <= 0");
      return tsl::Status(tsl::error::INVALID_ARGUMENT, "max_seq_length <= 0");
    return tsl::Status(tsl::error::INVALID_ARGUMENT, "Invalid input_h shape");
    return tsl::Status(tsl::error::INVALID_ARGUMENT, "Invalid input_c shape");
    return tsl::Status(tsl::error::INVALID_ARGUMENT, "Invalid output shape");
    return tsl::Status(tsl::error::INVALID_ARGUMENT, "Invalid output_h shape");
    return tsl::Status(tsl::error::INVALID_ARGUMENT, "Invalid output_c shape");
    return tsl::Status(tsl::error::INVALID_ARGUMENT,
        return tsl::Status(tsl::error::INTERNAL, "Failed to start timer");
        return tsl::Status(tsl::error::INTERNAL, "Failed to stop timer");
      return tsl::Status(tsl::error::INTERNAL, "Failed to start timer");
      return tsl::Status(tsl::error::INTERNAL, "Failed to stop timer");
        return tsl::Status(tsl::error::INTERNAL, "Failed to start timer");
        return tsl::Status(tsl::error::INTERNAL, "Failed to stop timer");
      return tsl::Status(tsl::error::INTERNAL, "Failed to start timer");
      return tsl::Status(tsl::error::INTERNAL, "Failed to stop timer");
  return tsl::Status(tsl::error::INVALID_ARGUMENT,
  return tsl::Status(tsl::error::INTERNAL,
  return tsl::Status(tsl::error::INTERNAL,
  return tsl::Status(tsl::error::INTERNAL,
        tsl::error::INTERNAL,
        tsl::error::INTERNAL,
    return tsl::Status(tsl::error::INVALID_ARGUMENT,
        tsl::error::INTERNAL,
        tsl::error::INTERNAL,
    return tsl::Status(tsl::error::INVALID_ARGUMENT,
        tsl::error::INTERNAL,
        tsl::error::INTERNAL,
    return tsl::Status(tsl::error::INVALID_ARGUMENT,
      return tsl::Status(tsl::error::INVALID_ARGUMENT,
        tsl::error::INVALID_ARGUMENT,
        tsl::error::INVALID_ARGUMENT,
        return tsl::Status(tsl::error::INTERNAL, "Failed to start timer");
            tsl::error::FAILED_PRECONDITION,
        return tsl::Status(tsl::error::INTERNAL, "Failed to stop timer");
        return tsl::Status(tsl::error::INTERNAL, "Failed to start timer");
        return tsl::Status(tsl::error::INTERNAL, "Failed to stop timer");
          tsl::error::UNKNOWN,
        return tsl::Status(tsl::error::INTERNAL, "Failed to start timer");
      return tsl::Status(tsl::error::FAILED_PRECONDITION,
        return tsl::Status(tsl::error::INTERNAL, "Failed to stop timer");
    return tsl::Status(tsl::error::INVALID_ARGUMENT,
      return tsl::Status(tsl::error::UNKNOWN,
    return tsl::Status(tsl::error::INTERNAL,
    return tsl::Status(tsl::error::INTERNAL,
          tsl::error::INTERNAL,
    return tsl::Status(tsl::error::INVALID_ARGUMENT,
  return tsl::Status(tsl::error::INVALID_ARGUMENT,
    return tsl::Status(tsl::error::INVALID_ARGUMENT,
        tsl::error::INTERNAL,
    return tsl::Status(tsl::error::INTERNAL, "Cudnn pooling failed to split");
    return tsl::Status(tsl::error::INTERNAL, "Cudnn pooling failed to split");
#include "tensorflow/tsl/platform/errors.h"
  return tsl::Status(tsl::error::ABORTED,
  return tsl::Status(tsl::error::INTERNAL, message);
      tsl::error::INTERNAL,
    return tsl::Status(tsl::error::INVALID_ARGUMENT,
        tsl::error::INTERNAL,
    return tsl::Status(tsl::error::RESOURCE_EXHAUSTED,
        tsl::error::FAILED_PRECONDITION,
          tsl::error::UNAVAILABLE,
      tsl::error::INTERNAL,
            tsl::error::INTERNAL,
      tsl::error::INTERNAL,
        tsl::error::NOT_FOUND,
      tsl::error::INTERNAL,
        tsl::error::INTERNAL,
        tsl::error::INTERNAL,
      tsl::error::INTERNAL,
      tsl::error::INTERNAL,
        tsl::error::INTERNAL,
        tsl::error::INTERNAL,
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/tsl/platform/errors.h"
        tsl::error::INTERNAL,
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/tsl/platform/errors.h"
      tsl::error::NOT_FOUND,
        tsl::error::INTERNAL,
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
        "//tensorflow/tsl/platform:errors",
        "//tensorflow/compiler/xla/stream_executor:stream_executor_pimpl",  # fixdeps: keep
        "//tensorflow/tsl/platform:errors",
#include "tensorflow/tsl/platform/errors.h"
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/tsl/platform/errors.h"
        tsl::error::INTERNAL,
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
    return tsl::Status(tsl::error::INTERNAL,
        tsl::error::FAILED_PRECONDITION,
        tsl::error::FAILED_PRECONDITION,
        tsl::error::NOT_FOUND,
        tsl::error::NOT_FOUND,
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/tsl/platform/errors.h"
    return tsl::Status(tsl::error::UNIMPLEMENTED,
  return tsl::Status(tsl::error::UNIMPLEMENTED,
#include "tensorflow/tsl/platform/errors.h"
        tsl::error::ALREADY_EXISTS,
          tsl::error::NOT_FOUND,
            tsl::error::FAILED_PRECONDITION,                                  \
      return tsl::Status(tsl::error::FAILED_PRECONDITION,                     \
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/tsl/platform/errors.h"
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/tsl/platform/errors.h"
#include "tensorflow/tsl/platform/errors.h"
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/tsl/platform/errors.h"
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/tsl/platform/errors.h"
#include "tensorflow/compiler/xla/stream_executor/platform/initialize.h"
#include "tensorflow/tsl/platform/errors.h"
    return tsl::Status(tsl::error::UNKNOWN,
    return tsl::Status(tsl::error::UNKNOWN,
    return tsl::Status(tsl::error::UNKNOWN,
    return tsl::Status(tsl::error::UNKNOWN,
      tsl::error::NOT_FOUND,
        tsl::error::INTERNAL,
        tsl::error::INTERNAL,
    FunctionLibraryRuntime::Options opts(ctx->step_id());
        "//tensorflow/core:framework",
    int port, const std::string& protocol, const std::string& server_type,
      const std::string& server_type,
        "//tensorflow/tsl/platform:errors",
        "//tensorflow/tsl/platform:statusor",
        "//tensorflow/tsl/platform:status_matchers",
        "//tensorflow/tsl/protobuf:protos_all_cc",
#include <utility>
#include <vector>
#include "absl/strings/str_split.h"
#include "tensorflow/tsl/platform/errors.h"
#include "tensorflow/tsl/platform/statusor.h"
tsl::StatusOr<std::pair<int64_t, int64_t>> SplitIndex(
    absl::string_view split_path) {
  std::vector<std::string> tokens = absl::StrSplit(split_path, '_');
  int64_t local_split_index = 0, global_split_index = 0;
  if (tokens.size() != 3 || tokens[0] != "split" ||
      !absl::SimpleAtoi(tokens[1], &local_split_index) ||
      local_split_index < 0 ||
      !absl::SimpleAtoi(tokens[2], &global_split_index) ||
      global_split_index < 0) {
    return tsl::errors::InvalidArgument(
        "Invalid split file name: ", split_path,
        ". Expected split_<local_split_index>_<global_split_index>.");
  }
  if (local_split_index > global_split_index) {
    return tsl::errors::InvalidArgument(
        "Invalid split file name: ", split_path, ". The local split index ",
        local_split_index, " exceeds the global split index ",
        global_split_index, ".");
  }
  return std::make_pair(local_split_index, global_split_index);
}

#include <utility>
#include "tensorflow/tsl/platform/statusor.h"
// Returns a pair of {local_split_index, global_split_index} of the split. The
// expected format of `split_path` is:
// split_<local_split_index>_<global_split_index>
tsl::StatusOr<std::pair<int64_t, int64_t>> SplitIndex(
    absl::string_view split_path);

#include "tensorflow/tsl/platform/status_matchers.h"
#include "tensorflow/tsl/protobuf/error_codes.pb.h"
using ::testing::HasSubstr;
using ::testing::Pair;
using tsl::testing::IsOkAndHolds;
using tsl::testing::StatusIs;
TEST(PathUtilsTest, SplitIndex) {
  EXPECT_THAT(SplitIndex("split_0_1"), IsOkAndHolds(Pair(0, 1)));
}

TEST(PathUtilsTest, InvalidSplitFile) {
  EXPECT_THAT(
      SplitIndex(""),
      StatusIs(error::INVALID_ARGUMENT,
               HasSubstr(
                   "Expected split_<local_split_index>_<global_split_index>")));
  EXPECT_THAT(
      SplitIndex("split_123"),
      StatusIs(error::INVALID_ARGUMENT,
               HasSubstr(
                   "Expected split_<local_split_index>_<global_split_index>")));
  EXPECT_THAT(
      SplitIndex("split_-1_(-1)"),
      StatusIs(error::INVALID_ARGUMENT,
               HasSubstr(
                   "Expected split_<local_split_index>_<global_split_index>")));
  EXPECT_THAT(
      SplitIndex("split_5_0"),
      StatusIs(
          error::INVALID_ARGUMENT,
          HasSubstr(
              "The local split index 5 exceeds the global split index 0")));
}

    TF_ASSIGN_OR_RETURN(auto split_index, SplitIndex(split_filename));
    auto [local_split_index, global_split_index] = split_index;
TfDatazMetricsCollector::TfDatazMetricsCollector(const Env& env,
                                                 IteratorBase* iterator)
    : iterator_(iterator), latency_estimator_(env) {}
int64_t TfDatazMetricsCollector::GetIteratorTotalMemoryUsage() {
  return iterator_->TotalBufferedBytes();
}

#include "tensorflow/core/framework/dataset.h"
  TfDatazMetricsCollector(const Env& env, IteratorBase* iterator);
  // Returns the total memory (in bytes) used by the iterator.
  // Total memory used by the iterator includes the total number of bytes
  // buffered in all nodes in the subtree.
  int64_t GetIteratorTotalMemoryUsage();

  IteratorBase* iterator_;  // not owned
#include "tensorflow/core/framework/dataset.h"
    tfdataz_metrics_ =
        std::make_unique<TfDatazMetricsCollector>(*env_, iterator_.get());
  std::unique_ptr<IteratorBase> iterator_;
  std::unique_ptr<IteratorBase> iterator;
  auto collector_one = std::make_shared<TfDatazMetricsCollector>(
      *Env::Default(), iterator.get());
  auto collector_two = std::make_shared<TfDatazMetricsCollector>(
      *Env::Default(), iterator.get());
  std::unique_ptr<IteratorBase> iterator;
  auto collector_one = std::make_shared<TfDatazMetricsCollector>(
      *Env::Default(), iterator.get());
  auto collector_two = std::make_shared<TfDatazMetricsCollector>(
      *Env::Default(), iterator.get());
  auto collector_three = std::make_shared<TfDatazMetricsCollector>(
      *Env::Default(), iterator.get());
                   absl::Cord(error_source_proto.SerializeAsString()));
    s.SetPayload(tsl::CoordinationErrorPayloadKey(),
                 absl::Cord("testing error payload"));
  // Returns the total number of bytes buffered by the iterator across all nodes
  // in the subtree for which autotuning is enabled.
  int64_t TotalBufferedBytes() const {
    if (node_) return node_->TotalBufferedBytes();
    return 0;
  }

        STATUS.SetPayload(PAYLOAD_KEY, absl::Cord(PAYLOAD_VALUE));             \
  tf_dataz_metrics_collector_ =
      std::make_shared<TfDatazMetricsCollector>(env_, iterator.get());
  TfDatazMetricsRegistry::Register(tf_dataz_metrics_collector_);
    FunctionLibraryRuntime::Options opts(ctx->step_id());
          lib_(CHECK_NOTNULL(ctx_->function_library())),
          opts_(ctx->step_id()) {
          lib_(CHECK_NOTNULL(ctx_->function_library())),
          opts_(ctx->step_id()) {
          lib_(CHECK_NOTNULL(ctx_->function_library())),
          opts_(ctx->step_id()) {
          opts_(ctx->step_id()),
    // Sanity checks for input shapes.

    // Shape of 'x' must be [batch_size, input_size]
    OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(x_tensor->shape()),
                errors::InvalidArgument("Rank of x must be 2", x_tensor->dims(),
                                        " vs. 2"));
    OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(h_prev_tensor->shape()),
                errors::InvalidArgument("Rank of h_prev must be 2, got ",
                                        h_prev_tensor->dims()));
    const int64_t cell_size = h_prev_tensor->dim_size(1);
    OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(w_ru_tensor->shape()),
                errors::InvalidArgument("Rank of w_ru_ must be 2, got ",
                                        w_ru_tensor->dims()));
    OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(w_c_tensor->shape()),
                errors::InvalidArgument("Rank of w_c must be 2, got ",
                                        w_c_tensor->dims()));
    OP_REQUIRES(ctx, TensorShapeUtils::IsVector(b_ru_tensor->shape()),
                errors::InvalidArgument("Rank of b_ru must be 1, got ",
                                        b_ru_tensor->dims()));
    OP_REQUIRES(ctx, TensorShapeUtils::IsVector(b_c_tensor->shape()),
                errors::InvalidArgument("Rank of b_c must be 1, got ",
                                        b_c_tensor->dims()));
    // Shape of 'x' must be [batch_size, input_size]
    OP_REQUIRES(
        ctx, TensorShapeUtils::IsMatrix(x_tensor->shape()),
        errors::InvalidArgument("Rank of x must be 2, got ", x_tensor->dims()));
    // Shape of 'h' must be [batch_size, cell_size]
    OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(h_prev_tensor->shape()),
                errors::InvalidArgument("Rank of h_prev must be 2, got ",
                                        h_prev_tensor->dims()));
    const int64_t cell_size = h_prev_tensor->dim_size(1);
    OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(w_ru_tensor->shape()),
                errors::InvalidArgument("Rank of w_ru_ must be 2, got ",
                                        w_ru_tensor->dims()));
    OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(w_c_tensor->shape()),
                errors::InvalidArgument("Rank of w_c must be 2, got ",
                                        w_c_tensor->dims()));
    OP_REQUIRES(ctx, TensorShapeUtils::IsVector(b_ru_tensor->shape()),
                errors::InvalidArgument("Rank of b_ru must be 1, got ",
                                        b_ru_tensor->dims()));
    OP_REQUIRES(ctx, TensorShapeUtils::IsVector(b_c_tensor->shape()),
                errors::InvalidArgument("Rank of b_c must be 1, got ",
                                        b_c_tensor->dims()));
    OP_REQUIRES(
        ctx, TensorShapeUtils::IsMatrix(r_tensor->shape()),
        errors::InvalidArgument("Rank of r must be 2, got ", r_tensor->dims()));
    OP_REQUIRES(
        ctx, TensorShapeUtils::IsMatrix(u_tensor->shape()),
        errors::InvalidArgument("Rank of u must be 2, got ", u_tensor->dims()));
    OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(c_tensor->shape()),
                errors::InvalidArgument("Rank of w_c must be 2, got ",
                                        c_tensor->dims()));
    OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(d_h_tensor->shape()),
                errors::InvalidArgument("Rank of d_h must be 2, got ",
                                        d_h_tensor->dims()));
  s.SetPayload("Invalid", absl::Cord("Invalid Val"));
  s.SetPayload("Error key", absl::Cord("Original"));
  s.SetPayload("Error key", absl::Cord("Updated"));
  s.SetPayload("Error key", absl::Cord("Original"));
                      absl::Cord(error_source_proto.SerializeAsString()));
                      absl::Cord(output.scalar<tstring>()()));
  FunctionLibraryRuntime::Options opts(ctx->step_id());
  FunctionLibraryRuntime::Options opts(ctx->step_id());
  FunctionLibraryRuntime::Options opts(ctx->step_id());
    status.SetPayload(kTpuEmbeddingErrorUrl,
                      absl::Cord(error_payload.SerializeAsString()));
    status.SetPayload(kTpuEmbeddingErrorUrl,
                      absl::Cord(error_payload.SerializeAsString()));
inline int64_t GetMempool() {
inline bool IsBlockedFormatEnabled() {
### Floating-Point (IEEE FP16) Operators
format. Currently, this hardware is limited to ARM & ARM64 devices with
ARMv8.2 FP16 arithmetics extension, and includes Android phones starting with
Pixel 3, Galaxy S9 (Snapdragon SoC), Galaxy S10 (Exynos SoC), iOS devices with
A11 or newer SoCs, all Apple Silicon Macs, and Windows ARM64 laptops based with
Snapdragon 850 SoC or newer.
is compatible with FP16 inference. The metadata can be added during model
conversion using the `_experimental_supported_accumulation_type` attribute
of the [tf.lite.TargetSpec](https://www.tensorflow.org/api_docs/python/tf/lite/TargetSpec)
object:

```python
converter.optimizations = [tf.lite.Optimize.DEFAULT]
...
converter.target_spec.supported_types = [tf.float16]
converter.target_spec._experimental_supported_accumulation_type = tf.dtypes.float16
```
converted to FP16 and back to FP32. Note that such simulation is not bit-exact
XNNPACK has full feature parity between FP32 and FP16 operators: all operators
that are supported for FP32 inference are also supported for FP16 inference,
and vice versa. In particular, sparse inference operators are supported for FP16
inference on ARM processors.
inference is restricted to subgraphs with the following floating-point
operators:
    with self.assertRaisesRegex(
        ValueError, "Expected split_<local_split_index>_<global_split_index>"):
    with self.assertRaisesRegex(
        ValueError, "The local split index 1 exceeds the global split index 0"):
    # TODO(b/266747022): remove extra visibility
    visibility = visibility + ["//learning/brain/experimental:__subpackages__"],
    status.SetPayload("key1", absl::Cord("value1"));
    status.SetPayload("key2", absl::Cord("value2"));
from tensorflow.python.eager.def_function import functions_run_eagerly
from tensorflow.python.eager.def_function import run_functions_eagerly
    run_eagerly = functions_run_eagerly()
    if run_eagerly:
      logging.warning(
          "It looks like tf.function behavior was disabled, perhaps using"
          " tf.config.run_functions_eagerly."
          " tf.tpu.experimental.initialize_tpu_system requires tf.function to"
          " work. This primitive will override the disable."
      )
    run_functions_eagerly(False)
    finally:
      if run_eagerly is not None:
        run_functions_eagerly(run_eagerly)
    run_eagerly = functions_run_eagerly()
    if run_eagerly:
      logging.warning(
          "It looks like tf.function behavior was disabled, perhaps using"
          " tf.config.run_functions_eagerly."
          " tf.tpu.experimental.shutdown_tpu_system requires tf.function to"
          " work. This primitive will override the disable."
      )
    run_functions_eagerly(False)
    try:
      with ops.device(tpu._tpu_system_device_name(job)):  # pylint: disable=protected-access
        _tpu_shutdown_fn()
    finally:
      if run_eagerly is not None:
        run_functions_eagerly(run_eagerly)
numpy ~= 1.22.0; python_version < '3.11'
wheel ~= 0.38.1
packaging
certifi ~= 2022.12.07
numpy ~= 1.22.0; python_version < '3.11'
wheel ~= 0.38.1
pylint ~= 2.13.9
  s->status.SetPayload(key, absl::Cord(absl::string_view(value)));
  cc_status.SetPayload("key1", absl::Cord("value1"));
  cc_status.SetPayload("key2", absl::Cord("value2"));
  s.SetPayload(CoordinationErrorPayloadKey(), absl::Cord(""));
  s.SetPayload(CoordinationErrorPayloadKey(),
               absl::Cord(error.SerializeAsString()));
  s.SetPayload(CoordinationErrorPayloadKey(),
               absl::Cord(payload.SerializeAsString()));
      s.SetPayload(key_val.first, absl::Cord(key_val.second));
                 absl::Cord(tensorflow::distributed_runtime::GrpcPayloadsLost()
                                .SerializeAsString()));
  status.SetPayload("a", absl::Cord("\\xFF\\x02\\x03"));
#include "absl/strings/cord.h"
    status.SetPayload(payload.first, absl::Cord(payload.second));
    to.SetPayload(key, absl::Cord(value));
// Constant which is false internally and true in open source.
#ifdef PLATFORM_GOOGLE
inline constexpr bool kIsOpenSource = false;
#else
inline constexpr bool kIsOpenSource = true;
#endif  // PLATFORM_GOOGLE

        "@com_google_absl//absl/base:core_headers",
        "@com_google_absl//absl/strings:str_format",
#include "absl/base/attributes.h"
  // String conversions of value types are supported via AlphaNum. We keep a
  // reference to the AlphaNum's internal buffer here, so it must remain valid
  // for the lifetime of this object. We cannot store it by value because it is
  // not safe to construct an AlphaNum as a member of a class, particularly when
  // AbslStringify is being used (it may reference default arguments that are on
  // the caller's stack, if we constructed it here those default arguments would
  // be destroyed before they are used).
  TraceMeArg(absl::string_view k,
             const absl::AlphaNum& v ABSL_ATTRIBUTE_LIFETIME_BOUND)
      : key(k), value(v.Piece()) {}
  absl::string_view value;
      out = Append(out, arg.value);
#include "absl/strings/str_format.h"
// This can be removed when the absl version has been updated to include
// AbslStringify for open source builds.
#if defined(PLATFORM_GOOGLE)

struct Point {
  template <typename Sink>
  friend void AbslStringify(Sink& sink, const Point& p) {
    absl::Format(&sink, "(%d, %d)", p.x, p.y);
  }

  int x;
  int y;
};

TEST(TraceMeEncodeTest, AbslStringifyTest) {
  EXPECT_EQ(TraceMeEncode("Plot", {{"point", Point{10, 20}}}),
            "Plot#point=(10, 20)#");
}

#endif

    TFRT_COMMIT = "c653281a1a23c0c3d41536a983c7d10fcc5b1fbf"
    TFRT_SHA256 = "3d1edd27c4e36d9cfc9493aef7088489babb370d2a7955bab3545acfbb024ccf"