style: run clang-format and configure pre-commit hooks
This commit is contained in:
@@ -23,23 +23,23 @@ namespace fces {
|
||||
*/
|
||||
class SpectralSensor {
|
||||
public:
|
||||
SpectralSensor() = default;
|
||||
explicit SpectralSensor(torch::nn::Module& model);
|
||||
SpectralSensor() = default;
|
||||
explicit SpectralSensor(torch::nn::Module &model);
|
||||
|
||||
/// Track a layer's weight tensor
|
||||
void track_layer(const std::string& name, const torch::Tensor& weight);
|
||||
/// Track a layer's weight tensor
|
||||
void track_layer(const std::string &name, const torch::Tensor &weight);
|
||||
|
||||
/// Get the global (average) effective rank
|
||||
float get_global_rank() const;
|
||||
/// Get the global (average) effective rank
|
||||
float get_global_rank() const;
|
||||
|
||||
/// Reset all tracked layers
|
||||
void reset();
|
||||
/// Reset all tracked layers
|
||||
void reset();
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, float> layer_ranks_;
|
||||
std::unordered_map<std::string, float> layer_ranks_;
|
||||
|
||||
/// Compute effective rank via SVD
|
||||
static float compute_effective_rank(const torch::Tensor& weight);
|
||||
/// Compute effective rank via SVD
|
||||
static float compute_effective_rank(const torch::Tensor &weight);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -47,8 +47,8 @@ private:
|
||||
*/
|
||||
class SpectralController {
|
||||
public:
|
||||
/// Compute the spectral alpha (gating factor for rank-aware updates)
|
||||
float compute_alpha(float global_rank, float grokking_coefficient) const;
|
||||
/// Compute the spectral alpha (gating factor for rank-aware updates)
|
||||
float compute_alpha(float global_rank, float grokking_coefficient) const;
|
||||
};
|
||||
|
||||
} // namespace fces
|
||||
} // namespace fces
|
||||
|
||||
Reference in New Issue
Block a user