mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-06 00:19:58 +01:00
Automated Code Change
PiperOrigin-RevId: 824851950
This commit is contained in:
parent
c6d737900f
commit
c45fcf1b1c
|
|
@ -85,7 +85,7 @@ string RunProfile(const string& command, const string& options,
|
|||
} // namespace
|
||||
|
||||
bool NewProfiler(const string* graph, const string* op_log) {
|
||||
std::unique_ptr<GraphDef> graph_ptr(new GraphDef());
|
||||
std::unique_ptr<GraphDef> graph_ptr = std::make_unique<GraphDef>();
|
||||
if (graph && !graph->empty()) {
|
||||
if (!graph_ptr->ParseFromString(*graph)) {
|
||||
if (!protobuf::TextFormat::ParseFromString(*graph, graph_ptr.get())) {
|
||||
|
|
@ -126,7 +126,7 @@ double AddStep(int64_t step, const string* graph, const string* run_meta,
|
|||
CHECK(tf_stat);
|
||||
|
||||
if (graph && !graph->empty()) {
|
||||
std::unique_ptr<GraphDef> graph_ptr(new GraphDef());
|
||||
std::unique_ptr<GraphDef> graph_ptr = std::make_unique<GraphDef>();
|
||||
if (!graph_ptr->ParseFromString(*graph)) {
|
||||
if (!protobuf::TextFormat::ParseFromString(*graph, graph_ptr.get())) {
|
||||
absl::FPrintF(stderr, "Failed to parse graph\n");
|
||||
|
|
@ -137,7 +137,7 @@ double AddStep(int64_t step, const string* graph, const string* run_meta,
|
|||
|
||||
CHECK(run_meta && !run_meta->empty());
|
||||
// TODO(xpan): Better error handling.
|
||||
std::unique_ptr<RunMetadata> run_meta_ptr(new RunMetadata());
|
||||
std::unique_ptr<RunMetadata> run_meta_ptr = std::make_unique<RunMetadata>();
|
||||
run_meta_ptr->ParseFromString(*run_meta);
|
||||
tf_stat->AddRunMeta(step, std::move(run_meta_ptr));
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ string PrintModelAnalysis(const string* graph, const string* run_meta,
|
|||
const string* options) {
|
||||
CHECK(command) << "command mustn't be null";
|
||||
CHECK(options) << "options mustn't be null";
|
||||
std::unique_ptr<GraphDef> graph_ptr(new GraphDef());
|
||||
std::unique_ptr<GraphDef> graph_ptr = std::make_unique<GraphDef>();
|
||||
if (graph && !graph->empty()) {
|
||||
graph_ptr->ParseFromString(*graph);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,19 +41,20 @@ class TFProfShowTest : public ::testing::Test {
|
|||
string graph_path =
|
||||
io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/graph.pbtxt");
|
||||
std::unique_ptr<tensorflow::GraphDef> graph_pb(new tensorflow::GraphDef());
|
||||
std::unique_ptr<tensorflow::GraphDef> graph_pb =
|
||||
std::make_unique<tensorflow::GraphDef>();
|
||||
TF_CHECK_OK(
|
||||
ReadProtoFile(Env::Default(), graph_path, graph_pb.get(), false));
|
||||
|
||||
std::unique_ptr<tensorflow::RunMetadata> run_meta_pb(
|
||||
new tensorflow::RunMetadata());
|
||||
std::unique_ptr<tensorflow::RunMetadata> run_meta_pb =
|
||||
std::make_unique<tensorflow::RunMetadata>();
|
||||
string run_meta_path =
|
||||
io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/run_meta");
|
||||
TF_CHECK_OK(
|
||||
ReadProtoFile(Env::Default(), run_meta_path, run_meta_pb.get(), true));
|
||||
|
||||
std::unique_ptr<OpLogProto> op_log_pb(new OpLogProto());
|
||||
std::unique_ptr<OpLogProto> op_log_pb = std::make_unique<OpLogProto>();
|
||||
string op_log_path =
|
||||
io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/tfprof_log");
|
||||
|
|
@ -62,8 +63,8 @@ class TFProfShowTest : public ::testing::Test {
|
|||
string ckpt_path = io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/ckpt");
|
||||
TF_Status* status = TF_NewStatus();
|
||||
std::unique_ptr<checkpoint::CheckpointReader> ckpt_reader(
|
||||
new checkpoint::CheckpointReader(ckpt_path, status));
|
||||
std::unique_ptr<checkpoint::CheckpointReader> ckpt_reader =
|
||||
std::make_unique<checkpoint::CheckpointReader>(ckpt_path, status);
|
||||
CHECK(TF_GetCode(status) == TF_OK);
|
||||
TF_DeleteStatus(status);
|
||||
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ TFStats::TFStats(const string& filename,
|
|||
id_to_string_[entry.first] = entry.second;
|
||||
}
|
||||
for (const auto& node_pb : profile.nodes()) {
|
||||
std::unique_ptr<TFGraphNode> node(
|
||||
new TFGraphNode(node_pb.second, profile, &id_to_string_, &nodes_map_));
|
||||
std::unique_ptr<TFGraphNode> node = std::make_unique<TFGraphNode>(
|
||||
node_pb.second, profile, &id_to_string_, &nodes_map_);
|
||||
nodes_map_.insert(std::pair<string, std::unique_ptr<TFGraphNode>>(
|
||||
node_pb.second.name(), std::move(node)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,19 +35,20 @@ class TFProfStatsTest : public ::testing::Test {
|
|||
string graph_path =
|
||||
io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/graph.pbtxt");
|
||||
std::unique_ptr<tensorflow::GraphDef> graph_pb(new tensorflow::GraphDef());
|
||||
std::unique_ptr<tensorflow::GraphDef> graph_pb =
|
||||
std::make_unique<tensorflow::GraphDef>();
|
||||
TF_CHECK_OK(
|
||||
ReadProtoFile(Env::Default(), graph_path, graph_pb.get(), false));
|
||||
|
||||
std::unique_ptr<tensorflow::RunMetadata> run_meta_pb(
|
||||
new tensorflow::RunMetadata());
|
||||
std::unique_ptr<tensorflow::RunMetadata> run_meta_pb =
|
||||
std::make_unique<tensorflow::RunMetadata>();
|
||||
string run_meta_path =
|
||||
io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/run_meta");
|
||||
TF_CHECK_OK(
|
||||
ReadProtoFile(Env::Default(), run_meta_path, run_meta_pb.get(), true));
|
||||
|
||||
std::unique_ptr<OpLogProto> op_log_pb(new OpLogProto());
|
||||
std::unique_ptr<OpLogProto> op_log_pb = std::make_unique<OpLogProto>();
|
||||
string op_log_path =
|
||||
io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/tfprof_log");
|
||||
|
|
@ -56,8 +57,8 @@ class TFProfStatsTest : public ::testing::Test {
|
|||
string ckpt_path = io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/ckpt");
|
||||
TF_Status* status = TF_NewStatus();
|
||||
std::unique_ptr<checkpoint::CheckpointReader> ckpt_reader(
|
||||
new checkpoint::CheckpointReader(ckpt_path, status));
|
||||
std::unique_ptr<checkpoint::CheckpointReader> ckpt_reader =
|
||||
std::make_unique<checkpoint::CheckpointReader>(ckpt_path, status);
|
||||
CHECK(TF_GetCode(status) == TF_OK);
|
||||
TF_DeleteStatus(status);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ class TFProfTensorTest : public ::testing::Test {
|
|||
string graph_path =
|
||||
io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/graph.pbtxt");
|
||||
std::unique_ptr<tensorflow::GraphDef> graph_pb(new tensorflow::GraphDef());
|
||||
std::unique_ptr<tensorflow::GraphDef> graph_pb =
|
||||
std::make_unique<tensorflow::GraphDef>();
|
||||
TF_CHECK_OK(
|
||||
ReadProtoFile(Env::Default(), graph_path, graph_pb.get(), false));
|
||||
|
||||
|
|
@ -43,8 +44,8 @@ class TFProfTensorTest : public ::testing::Test {
|
|||
string ckpt_path = io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/ckpt");
|
||||
TF_Status* status = TF_NewStatus();
|
||||
std::unique_ptr<checkpoint::CheckpointReader> ckpt_reader(
|
||||
new checkpoint::CheckpointReader(ckpt_path, status));
|
||||
std::unique_ptr<checkpoint::CheckpointReader> ckpt_reader =
|
||||
std::make_unique<checkpoint::CheckpointReader>(ckpt_path, status);
|
||||
CHECK(TF_GetCode(status) == TF_OK);
|
||||
TF_DeleteStatus(status);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,12 +35,13 @@ class TFProfTimelineTest : public ::testing::Test {
|
|||
string graph_path =
|
||||
io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/graph.pbtxt");
|
||||
std::unique_ptr<tensorflow::GraphDef> graph_pb(new tensorflow::GraphDef());
|
||||
std::unique_ptr<tensorflow::GraphDef> graph_pb =
|
||||
std::make_unique<tensorflow::GraphDef>();
|
||||
TF_CHECK_OK(
|
||||
ReadProtoFile(Env::Default(), graph_path, graph_pb.get(), false));
|
||||
|
||||
std::unique_ptr<tensorflow::RunMetadata> run_meta_pb(
|
||||
new tensorflow::RunMetadata());
|
||||
std::unique_ptr<tensorflow::RunMetadata> run_meta_pb =
|
||||
std::make_unique<tensorflow::RunMetadata>();
|
||||
string run_meta_path =
|
||||
io::JoinPath(testing::TensorFlowSrcRoot(),
|
||||
"core/profiler/internal/testdata/run_meta");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user