Skip to content

Commit

Permalink
Migrate ConvertMlirToGraphdef uses to tf2xla version and deprecate tr…
Browse files Browse the repository at this point in the history
…anslate version.

PiperOrigin-RevId: 642329411
  • Loading branch information
rocketas authored and tensorflower-gardener committed Jun 11, 2024
1 parent 5636dc7 commit 0a063f3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tensorflow/compiler/mlir/tensorflow/translate/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ cc_library(
"//tensorflow/core:lib",
"//tensorflow/core:protos_all_cc",
"//tensorflow/core/graph/regularization:util",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/container:inlined_vector",
Expand All @@ -238,13 +239,12 @@ cc_library(
":translate_cl_options",
":translate_lib",
"//tensorflow/compiler/mlir/tensorflow",
"//tensorflow/compiler/mlir/tf2xla/api/v2:tf_executor_to_graph",
"//tensorflow/compiler/tf2xla:xla_compiler",
"//tensorflow/compiler/tf2xla/kernels:xla_ops",
"//tensorflow/core:core_cpu_base",
"//tensorflow/core:framework",
"//tensorflow/core:protos_all_cc",
"@llvm-project//llvm:Support",
"@llvm-project//mlir:FuncDialect",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:TranslateLib",
"@local_tsl//tsl/platform:protobuf",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.
#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_EXPORT_GRAPHDEF_H_
#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_EXPORT_GRAPHDEF_H_

#include "absl/base/attributes.h"
#include "absl/container/flat_hash_set.h"
#include "llvm/ADT/StringRef.h"
#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project
Expand All @@ -29,6 +30,8 @@ limitations under the License.
#include "tensorflow/core/graph/graph.h"

namespace tensorflow {

ABSL_DEPRECATED("Use tensorflow::tf2xla::api::ConvertMlirToGraphdef instead.")
// Given an MLIR module, returns a GraphDef.
absl::StatusOr<std::unique_ptr<GraphDef>> ConvertMlirToGraphdef(
mlir::ModuleOp module, const GraphExportConfig& configs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ limitations under the License.
#include "tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_flags.h"
#include "tensorflow/compiler/mlir/tensorflow/translate/tf_mlir_translate.h"
#include "tensorflow/compiler/mlir/tensorflow/translate/tf_mlir_translate_cl.h"
#include "tensorflow/compiler/mlir/tf2xla/api/v2/tf_executor_to_graph.h"
#include "tensorflow/compiler/tf2xla/xla_compiler.h"
#include "xla/client/client_library.h"
#include "xla/client/compile_only_client.h"
Expand Down Expand Up @@ -173,7 +174,7 @@ static LogicalResult MlirToGraphdefTranslateFunction(
confs.export_original_tf_func_name = export_original_tf_func_name;

absl::StatusOr<std::unique_ptr<tensorflow::GraphDef>> graphdef_or(
tensorflow::ConvertMlirToGraphdef(module, confs));
tensorflow::tf2xla::v2::ConvertMlirToGraphdef(module, confs));
if (!graphdef_or.status().ok()) {
LOG(ERROR) << "Graph export failed: " << graphdef_or.status();
return mlir::failure();
Expand Down

0 comments on commit 0a063f3

Please sign in to comment.