Skip to content

Commit

Permalink
fix(torch): metrics naming for multiple test sets
Browse files Browse the repository at this point in the history
  • Loading branch information
Bycob authored and mergify[bot] committed Oct 4, 2022
1 parent b2157fd commit 17b8cbb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/backends/torch/torchlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1209,8 +1209,11 @@ namespace dd
std::vector<std::string> meas_names = meas_obj.list_keys();
for (auto name : meas_names)
{
std::string metric_name
= name + "_test" + std::to_string(i);
std::string metric_name;
if (i == 0)
metric_name = name;
else
metric_name = name + "_test" + std::to_string(i - 1);

if (name != "cmdiag" && name != "cmfull"
&& name != "clacc" && name != "cliou"
Expand Down
8 changes: 8 additions & 0 deletions tests/ut-torchapi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,14 @@ TEST(torchapi, service_train_resume)
}

// remove files
ASSERT_TRUE(fileops::file_exists(resnet50_train_repo + "best_model.txt"));
remove((resnet50_train_repo + "best_model.txt").c_str());
ASSERT_TRUE(
fileops::file_exists(resnet50_train_repo + "best_model_test_0.txt"));
remove((resnet50_train_repo + "best_model_test_0.txt").c_str());
ASSERT_FALSE(
fileops::file_exists(resnet50_train_repo + "best_model_test_1.txt"));

std::unordered_set<std::string> lfiles;
fileops::list_directory(resnet50_train_repo, true, false, false, lfiles);
for (std::string ff : lfiles)
Expand Down

0 comments on commit 17b8cbb

Please sign in to comment.