Refactor TensorUtils to a unique header file

This commit is contained in:
2025-07-21 11:10:26 +02:00
parent 5fd0ef692d
commit b990684581
13 changed files with 21 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
#include <sstream>
#include "Scores.h"
#include "common/TensorUtils.h" // tensorToVector
#include "common/TensorUtils.hpp" // tensorToVector
#include "common/Colors.h"
namespace platform {
Scores::Scores(torch::Tensor& y_test, torch::Tensor& y_proba, int num_classes, std::vector<std::string> labels) : num_classes(num_classes), labels(labels), y_test(y_test), y_proba(y_proba)
@@ -50,7 +50,7 @@ namespace platform {
auto nClasses = num_classes;
if (num_classes == 2)
nClasses = 1;
auto y_testv = tensorToVector<int>(y_test);
auto y_testv = TensorUtils::tensorToVector<int>(y_test);
std::vector<double> aucScores(nClasses, 0.0);
std::vector<std::pair<double, int>> scoresAndLabels;
for (size_t classIdx = 0; classIdx < nClasses; ++classIdx) {