Updated code to be compatible with passing string_view
PiperOrigin-RevId: 327649100 Change-Id: Ie3cba0acb7dac35d2df9cbd5a211f84c5922f9c7
This commit is contained in:
parent
b954e55670
commit
ccf99981e7
@ -99,7 +99,7 @@ PYBIND11_MODULE(_pywrap_tf_cluster, m) {
|
||||
std::vector<tensorflow::NamedDevice> named_devices;
|
||||
for (const auto& s : serialized_named_devices) {
|
||||
tensorflow::NamedDevice named_device;
|
||||
if (!named_device.ParseFromString(s)) {
|
||||
if (!named_device.ParseFromString(std::string(s))) {
|
||||
throw std::invalid_argument(
|
||||
"The NamedDevice could not be parsed as a valid protocol "
|
||||
"buffer");
|
||||
@ -241,7 +241,7 @@ PYBIND11_MODULE(_pywrap_tf_cluster, m) {
|
||||
|
||||
m.def("TF_EstimatePerformance", [](const py::bytes& serialized_device) {
|
||||
tensorflow::NamedDevice device;
|
||||
if (!device.ParseFromString(serialized_device)) {
|
||||
if (!device.ParseFromString(std::string(serialized_device))) {
|
||||
throw std::invalid_argument(
|
||||
"The NamedDevice could not be parsed as a valid protocol buffer");
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ PYBIND11_MODULE(_pywrap_cost_analyzer, m) {
|
||||
[](const py::bytes& serialized_metagraph, bool per_node_report,
|
||||
bool verbose, tensorflow::grappler::Cluster* cluster) -> py::bytes {
|
||||
tensorflow::MetaGraphDef metagraph;
|
||||
if (!metagraph.ParseFromString(serialized_metagraph)) {
|
||||
if (!metagraph.ParseFromString(std::string(serialized_metagraph))) {
|
||||
return "The MetaGraphDef could not be parsed as a valid protocol "
|
||||
"buffer";
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ PYBIND11_MODULE(_pywrap_tf_item, m) {
|
||||
[](const py::bytes& serialized_metagraph, bool ignore_colocation,
|
||||
bool ignore_user_placement) -> tensorflow::grappler::GrapplerItem* {
|
||||
tensorflow::MetaGraphDef metagraph;
|
||||
if (!metagraph.ParseFromString(serialized_metagraph)) {
|
||||
if (!metagraph.ParseFromString(std::string(serialized_metagraph))) {
|
||||
throw std::invalid_argument(
|
||||
"The MetaGraphDef could not be parsed as a valid protocol "
|
||||
"buffer");
|
||||
|
@ -29,7 +29,7 @@ PYBIND11_MODULE(_pywrap_model_analyzer, m) {
|
||||
[](const py::bytes& serialized_metagraph, bool assume_valid_feeds,
|
||||
bool debug) -> py::bytes {
|
||||
tensorflow::MetaGraphDef metagraph;
|
||||
if (!metagraph.ParseFromString(serialized_metagraph)) {
|
||||
if (!metagraph.ParseFromString(std::string(serialized_metagraph))) {
|
||||
return "The MetaGraphDef could not be parsed as a valid protocol "
|
||||
"buffer";
|
||||
}
|
||||
|
@ -66,12 +66,13 @@ PYBIND11_MODULE(_pywrap_tf_optimizer, m) {
|
||||
const std::string& graph_id,
|
||||
bool strip_default_attributes) -> py::bytes {
|
||||
tensorflow::ConfigProto config_proto;
|
||||
if (!config_proto.ParseFromString(serialized_config_proto)) {
|
||||
if (!config_proto.ParseFromString(
|
||||
std::string(serialized_config_proto))) {
|
||||
throw std::invalid_argument(
|
||||
"The ConfigProto could not be parsed as a valid protocol buffer");
|
||||
}
|
||||
tensorflow::MetaGraphDef metagraph;
|
||||
if (!metagraph.ParseFromString(serialized_metagraph)) {
|
||||
if (!metagraph.ParseFromString(std::string(serialized_metagraph))) {
|
||||
throw std::invalid_argument(
|
||||
"The MetaGraphDef could not be parsed as a valid protocol "
|
||||
"buffer");
|
||||
|
Loading…
Reference in New Issue
Block a user