Skip to content

Commit

Permalink
Replace deprecated tensorflow::Status with absl::Status.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 720240454
  • Loading branch information
ZacharyGarrett authored and copybara-github committed Jan 27, 2025
1 parent de0a454 commit 9c59ea8
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 24 deletions.
7 changes: 0 additions & 7 deletions tensorflow_federated/cc/core/impl/executors/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ cc_test(
"@org_tensorflow//tensorflow/core:portable_gif_internal",
"@org_tensorflow//tensorflow/core:protos_all_cc",
"@org_tensorflow//tensorflow/core:tensorflow",
"@org_tensorflow//tensorflow/core/platform:status",
],
)

Expand Down Expand Up @@ -305,7 +304,6 @@ tff_cc_cpu_gpu_test(
"@org_tensorflow//tensorflow/core:framework",
"@org_tensorflow//tensorflow/core:protos_all_cc",
"@org_tensorflow//tensorflow/core:tensorflow",
"@org_tensorflow//tensorflow/core/platform:status",
],
)

Expand Down Expand Up @@ -358,7 +356,6 @@ pybind_extension(
"@com_google_absl//absl/strings",
"@federated_language//federated_language/proto:computation_cc_proto",
"@org_tensorflow//tensorflow/core:framework",
"@org_tensorflow//tensorflow/core/platform:status",
"@org_tensorflow//tensorflow/core/platform:strcat",
"@org_tensorflow//tensorflow/python/lib/core:ndarray_tensor_headers",
"@pybind11_abseil//pybind11_abseil:absl_casters",
Expand Down Expand Up @@ -706,7 +703,6 @@ cc_library(
"@federated_language//federated_language/proto:computation_cc_proto",
"@org_tensorflow//tensorflow/core:framework",
"@org_tensorflow//tensorflow/core/data:standalone",
"@org_tensorflow//tensorflow/core/platform:status",
],
)

Expand Down Expand Up @@ -764,7 +760,6 @@ cc_library(
"@org_tensorflow//tensorflow/core/common_runtime:device_mgr",
"@org_tensorflow//tensorflow/core/common_runtime:session",
"@org_tensorflow//tensorflow/core/common_runtime:session_options",
"@org_tensorflow//tensorflow/core/platform:status",
],
)

Expand Down Expand Up @@ -937,7 +932,6 @@ cc_library(
"@org_tensorflow//tensorflow/core/common_runtime:session",
"@org_tensorflow//tensorflow/core/data:standalone",
"@org_tensorflow//tensorflow/core/platform:macros",
"@org_tensorflow//tensorflow/core/platform:status",
],
)

Expand Down Expand Up @@ -979,7 +973,6 @@ tff_cc_cpu_gpu_test(
"@org_tensorflow//tensorflow/core:framework",
"@org_tensorflow//tensorflow/core:protos_all_cc",
"@org_tensorflow//tensorflow/core:tensorflow",
"@org_tensorflow//tensorflow/core/platform:status",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ limitations under the License
#include "google/protobuf/io/zero_copy_stream_impl.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/types.pb.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/platform/tstring.h"
#include "tensorflow_federated/cc/core/impl/executors/session_provider.h"
#include "tensorflow_federated/cc/core/impl/executors/value_test_utils.h"
Expand Down Expand Up @@ -139,7 +138,7 @@ TEST(DatasetFromTensorStructuresTest, ReturnsReducibleDataset) {
"output_tensor_1",
"output_tensor_2",
});
tf::Status status = session->Run(
absl::Status status = session->Run(
{
{reduce_dataset_input_name, serialized_dataset},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ limitations under the License
#include "tensorflow/core/framework/tensor_shape.h"
#include "tensorflow/core/framework/types.pb.h"
#include "tensorflow/core/graph/graph.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow_federated/cc/testing/status_matchers.h"

namespace tensorflow_federated {
Expand Down Expand Up @@ -85,7 +84,7 @@ inline federated_language::Computation ComputationV(

tensorflow::GraphDef graphdef_pb;

tensorflow::Status status = scope.ToGraphDef(&graphdef_pb);
absl::Status status = scope.ToGraphDef(&graphdef_pb);
CHECK(status.ok()) << status;

if (!function_defs.empty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ limitations under the License
#include "tensorflow/c/safe_ptr.h"
#include "tensorflow/c/tf_tensor.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/platform/strcat.h"
#include "tensorflow/python/lib/core/ndarray_tensor.h"
#include "tensorflow/python/lib/core/ndarray_tensor_bridge.h"
Expand Down Expand Up @@ -209,7 +208,7 @@ struct type_caster<tensorflow::Tensor> {
bool load(handle src, bool) {
{
tensorflow::Safe_TF_TensorPtr tf_tensor_ptr;
tensorflow::Status status = tensorflow::NdarrayToTensor(
absl::Status status = tensorflow::NdarrayToTensor(
/*ctx=*/nullptr, src.ptr(), &tf_tensor_ptr);
if (!status.ok()) {
LOG(ERROR) << status;
Expand All @@ -229,7 +228,7 @@ struct type_caster<tensorflow::Tensor> {
static handle cast(const tensorflow::Tensor tensor, return_value_policy,
handle) {
PyObject* result = nullptr;
tensorflow::Status status = tensorflow::TensorToNdarray(tensor, &result);
absl::Status status = tensorflow::TensorToNdarray(tensor, &result);
if (!status.ok()) {
PyErr_SetString(PyExc_ValueError, "Failed to create np.ndarray");
return nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ limitations under the License
#include "federated_language/proto/computation.pb.h"
#include "tensorflow/core/data/standalone.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow_federated/cc/core/impl/executors/dataset_utils.h"
#include "tensorflow_federated/cc/core/impl/executors/executor.h"
#include "tensorflow_federated/cc/core/impl/executors/sequence_intrinsics.h"
Expand Down Expand Up @@ -252,7 +251,7 @@ class Sequence {
}
}
std::unique_ptr<tensorflow::data::standalone::Iterator> iter;
tensorflow::Status iter_status;
absl::Status iter_status;
{
absl::ReaderMutexLock reader_lock(&dataset_mutex_);
iter_status = ds_.value()->MakeIterator(&iter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ limitations under the License
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/public/session.h"
#include "tensorflow/core/public/session_options.h"
#include "tensorflow_federated/cc/core/impl/executors/status_macros.h"
Expand Down Expand Up @@ -98,7 +97,7 @@ const AcceleratorDevices& GetAcceleratorDevices() {
int16_t num_gpus = 0;
int16_t num_tpus = 0;
std::vector<std::string> devices;
tensorflow::Status s =
absl::Status s =
tensorflow::DeviceFactory::ListAllPhysicalDevices(&devices);
if (!s.ok()) {
LOG(ERROR) << "Error detecting physical devices, defaulting to CPU only: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ limitations under the License
#include "absl/synchronization/mutex.h"
#include "tensorflow/core/common_runtime/device_mgr.h"
#include "tensorflow/core/framework/graph.pb.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/protobuf/rewriter_config.pb.h"
#include "tensorflow/core/public/session.h"
#include "tensorflow_federated/cc/core/impl/executors/status_macros.h"
Expand Down Expand Up @@ -58,7 +57,7 @@ class SessionProvider {
uint32_t function_id, int16_t session_id)
: session_(std::move(session)),
container_name_(absl::StrCat(function_id, "/", session_id)) {
tensorflow::Status status = session_->LocalDeviceManager(&device_mgr_);
absl::Status status = session_->LocalDeviceManager(&device_mgr_);
if (!status.ok()) {
LOG(FATAL) << "Unable to retrieve device manager for function ["
<< function_id << "] with session [" << session_id << "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ limitations under the License
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/framework/types.pb.h"
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/public/session.h"
#include "federated_language/proto/computation.pb.h"
#include "tensorflow_federated/cc/core/impl/executors/dataset_from_tensor_structures.h"
Expand Down Expand Up @@ -764,7 +763,7 @@ absl::Status MaterializeSequence(const tensorflow::Tensor& graph_def_tensor,
std::unique_ptr<tensorflow::data::standalone::Dataset> dataset =
TFF_TRY(DatasetFromGraphDefTensor(graph_def_tensor));
std::unique_ptr<tensorflow::data::standalone::Iterator> iterator;
tensorflow::Status iter_status = dataset->MakeIterator(&iterator);
absl::Status iter_status = dataset->MakeIterator(&iterator);
if (!iter_status.ok()) {
return absl::InternalError(absl::StrCat(
"Error creating iterator from dataset: ", iter_status.message()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ limitations under the License
#include "tensorflow/core/framework/tensor_shape.h"
#include "tensorflow/core/framework/types.pb.h"
#include "tensorflow/core/graph/graph.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow_federated/cc/core/impl/executors/array_shape_test_utils.h"
#include "tensorflow_federated/cc/core/impl/executors/array_test_utils.h"
#include "tensorflow_federated/cc/core/impl/executors/executor.h"
Expand Down Expand Up @@ -132,7 +131,7 @@ inline v0::Value ComputationV(
// by the C++ TensorFlow executor.
federated_language::TensorFlow* tensorflow_pb = comp_pb->mutable_tensorflow();
tensorflow::GraphDef graphdef_pb;
tensorflow::Status status = scope.ToGraphDef(&graphdef_pb);
absl::Status status = scope.ToGraphDef(&graphdef_pb);
CHECK(status.ok()) << status;
tensorflow_pb->mutable_graph_def()->PackFrom(graphdef_pb);
if (in_binding.has_value()) {
Expand Down

0 comments on commit 9c59ea8

Please sign in to comment.