Merge pull request #38562 from zhuzilin:run_callable-run_metadata
PiperOrigin-RevId: 339650871 Change-Id: I51dcf71555420b7d231e8154dd45dd723e56e5b9
This commit is contained in:
commit
eaf34ba378
@ -235,18 +235,13 @@ void RunCallableHelper(tensorflow::Session* session, int64_t handle,
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate a RunMetadata protobuf object to receive the metadata,
|
||||
// if the caller is expecting any.
|
||||
std::unique_ptr<RunMetadata> run_metadata_proto;
|
||||
if (run_metadata != nullptr) {
|
||||
run_metadata_proto.reset(new RunMetadata);
|
||||
}
|
||||
RunMetadata run_metadata_proto;
|
||||
|
||||
// Run the callable.
|
||||
std::vector<Tensor> output_tensors;
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
s = session->RunCallable(handle, input_tensors, &output_tensors,
|
||||
run_metadata_proto.get());
|
||||
&run_metadata_proto);
|
||||
Py_END_ALLOW_THREADS;
|
||||
|
||||
if (!s.ok()) {
|
||||
@ -256,7 +251,7 @@ void RunCallableHelper(tensorflow::Session* session, int64_t handle,
|
||||
|
||||
// If requested, serialize the RunMetadata to pass it back to the caller.
|
||||
if (run_metadata != nullptr) {
|
||||
s = MessageToBuffer(*run_metadata_proto, run_metadata);
|
||||
s = MessageToBuffer(run_metadata_proto, run_metadata);
|
||||
if (!s.ok()) {
|
||||
Set_TF_Status_from_Status(out_status, s);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user