Skip to content

Commit b7a4079

Browse files
committed
Minor bug fix: Training weight must not be 0
1 parent d6740bb commit b7a4079

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Quantize.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static inline void QuantCluster_Train(struct QuantCluster_t *Dst, const struct B
1515
struct BGRAf_t Dist = BGRAf_Sub(Data, &Dst->Centroid);
1616

1717
float DistW = BGRAf_Len2(&Dist);
18-
float TrainW = DistW; //! <- This will help outliers pop out more often
18+
float TrainW = 0.001f + DistW; //! <- This will help outliers pop out more often (must not be 0.0!)
1919
struct BGRAf_t TrainData = BGRAf_Muli( Data, TrainW);
2020
struct BGRAf_t DistData = BGRAf_Muli(&Dist, DistW);
2121
Dst->TrainWeight += TrainW, Dst->Train = BGRAf_Add(&Dst->Train, &TrainData);

0 commit comments

Comments
 (0)