mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-07 12:20:24 +01:00
[XLA] Propagate error code in computation replay tool.
PiperOrigin-RevId: 165654497
This commit is contained in:
parent
513def0bb2
commit
a1225879cd
|
|
@ -82,9 +82,10 @@ StatusOr<std::unique_ptr<Literal>> ReplayComputation(
|
||||||
return client->ExecuteAndTransfer(computation, execute_arguments);
|
return client->ExecuteAndTransfer(computation, execute_arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RealMain(tensorflow::gtl::ArraySlice<char*> args, bool use_fake_data) {
|
int RealMain(tensorflow::gtl::ArraySlice<char*> args, bool use_fake_data) {
|
||||||
Client* client = ClientLibrary::LocalClientOrDie();
|
Client* client = ClientLibrary::LocalClientOrDie();
|
||||||
tensorflow::Env* env = tensorflow::Env::Default();
|
tensorflow::Env* env = tensorflow::Env::Default();
|
||||||
|
int exit_status = EXIT_SUCCESS;
|
||||||
for (char* arg : args) {
|
for (char* arg : args) {
|
||||||
SessionModule module;
|
SessionModule module;
|
||||||
TF_CHECK_OK(tensorflow::ReadBinaryProto(env, arg, &module));
|
TF_CHECK_OK(tensorflow::ReadBinaryProto(env, arg, &module));
|
||||||
|
|
@ -93,6 +94,7 @@ void RealMain(tensorflow::gtl::ArraySlice<char*> args, bool use_fake_data) {
|
||||||
if (!result_status.ok()) {
|
if (!result_status.ok()) {
|
||||||
fprintf(stderr, "%s: error: %s\n", arg,
|
fprintf(stderr, "%s: error: %s\n", arg,
|
||||||
result_status.status().ToString().c_str());
|
result_status.status().ToString().c_str());
|
||||||
|
exit_status = EXIT_FAILURE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::unique_ptr<Literal> result = result_status.ConsumeValueOrDie();
|
std::unique_ptr<Literal> result = result_status.ConsumeValueOrDie();
|
||||||
|
|
@ -105,6 +107,7 @@ void RealMain(tensorflow::gtl::ArraySlice<char*> args, bool use_fake_data) {
|
||||||
Literal(module.result()).ToString().c_str());
|
Literal(module.result()).ToString().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return exit_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace tools
|
} // namespace tools
|
||||||
|
|
@ -126,6 +129,5 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
tensorflow::gtl::ArraySlice<char*> args(argv, argc);
|
tensorflow::gtl::ArraySlice<char*> args(argv, argc);
|
||||||
args.pop_front(); // Pop off the binary name, argv[0]
|
args.pop_front(); // Pop off the binary name, argv[0]
|
||||||
xla::tools::RealMain(args, use_fake_data);
|
return xla::tools::RealMain(args, use_fake_data);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user