| 125 | } |
| 126 | |
| 127 | tensorflow::Status Options::FromProtoStr(const string& opts_proto_str, |
| 128 | Options* opts) { |
| 129 | OptionsProto opts_pb; |
| 130 | if (!opts_pb.ParseFromString(opts_proto_str)) { |
| 131 | return tensorflow::Status( |
| 132 | tensorflow::error::INTERNAL, |
| 133 | strings::StrCat("Failed to parse option string from Python API: ", |
| 134 | opts_proto_str)); |
| 135 | } |
| 136 | |
| 137 | string output_type; |
| 138 | std::map<string, string> output_options; |
| 139 | tensorflow::Status s = |
| 140 | ParseOutput(opts_pb.output(), &output_type, &output_options); |
| 141 | if (!s.ok()) return s; |
| 142 | |
| 143 | if (!opts_pb.dump_to_file().empty()) { |
| 144 | fprintf(stderr, |
| 145 | "-dump_to_file option is deprecated. " |
| 146 | "Please use -output file:outfile=<filename>\n"); |
| 147 | fprintf(stderr, "-output %s is overwritten with -output file:outfile=%s\n", |
| 148 | opts_pb.output().c_str(), opts_pb.dump_to_file().c_str()); |
| 149 | output_type = kOutput[2]; |
| 150 | output_options.clear(); |
| 151 | output_options[kFileOpts[0]] = opts_pb.dump_to_file(); |
| 152 | } |
| 153 | |
| 154 | *opts = Options( |
| 155 | opts_pb.max_depth(), opts_pb.min_bytes(), opts_pb.min_peak_bytes(), |
| 156 | opts_pb.min_residual_bytes(), opts_pb.min_output_bytes(), |
| 157 | opts_pb.min_micros(), opts_pb.min_accelerator_micros(), |
| 158 | opts_pb.min_cpu_micros(), opts_pb.min_params(), opts_pb.min_float_ops(), |
| 159 | opts_pb.min_occurrence(), opts_pb.step(), opts_pb.order_by(), |
| 160 | std::vector<string>(opts_pb.account_type_regexes().begin(), |
| 161 | opts_pb.account_type_regexes().end()), |
| 162 | std::vector<string>(opts_pb.start_name_regexes().begin(), |
| 163 | opts_pb.start_name_regexes().end()), |
| 164 | std::vector<string>(opts_pb.trim_name_regexes().begin(), |
| 165 | opts_pb.trim_name_regexes().end()), |
| 166 | std::vector<string>(opts_pb.show_name_regexes().begin(), |
| 167 | opts_pb.show_name_regexes().end()), |
| 168 | std::vector<string>(opts_pb.hide_name_regexes().begin(), |
| 169 | opts_pb.hide_name_regexes().end()), |
| 170 | opts_pb.account_displayed_op_only(), |
| 171 | std::vector<string>(opts_pb.select().begin(), opts_pb.select().end()), |
| 172 | output_type, output_options); |
| 173 | return tensorflow::Status::OK(); |
| 174 | } |
| 175 | |
| 176 | string Options::ToString() const { |
| 177 | const string s = strings::Printf( |
nothing calls this directly
no test coverage detected