Add telemetry_and_inference example and finalize previous DLL/ABI fixes

This commit is contained in:
AI-anonymous
2026-05-19 23:05:56 +02:00
parent 3ac230d16e
commit 9c941f39a4
9 changed files with 505 additions and 30 deletions

View File

@@ -26,10 +26,11 @@ void SpectralSensor::reset() {
float SpectralSensor::compute_effective_rank(const torch::Tensor& weight) {
// SVD-based effective rank (Shannon entropy of normalized singular values)
auto svd = torch::linalg::svdvals(weight.to(torch::kFloat32));
auto svd_result = torch::svd(weight.to(torch::kFloat32));
auto svd = std::get<1>(svd_result);
auto s = svd / svd.sum();
auto log_s = torch::log(s + 1e-10f);
float entropy = -(s * log_s).sum().item<float>();
auto log_s = (s + 1e-10f).log();
float entropy = -s.mul(log_s).sum().item<float>();
return std::exp(entropy);
}