Update binary readme.

This commit is contained in:
Colin 2025-06-27 12:23:56 +08:00
parent a7e0bd508c
commit 9acd89c98e
1 changed files with 3 additions and 14 deletions

View File

@ -1,7 +1,7 @@
## 定义
### 梯度
### binary网络的梯度
1. 预测变化对整体损失 L 的影响程度, 参数θ在当前点的变化对损失值的影响方向和幅度
2. grad物理含义loss L = 0 的时候,需要的变化量
3. w = w - grad * lr 若梯度为正,权重应该减小
@ -16,18 +16,6 @@
1. 对于repeat的操作需要对grad_output进行sum
2. 对于bits->index的操作需要对grad_output进行repeat
### grad 计算
grad_output output input exp_grad grad_input
+ + + +
+ - + -
- + + -
- - + +
+ + - -
+ - - +
- + - +
- - - -
## 问题
* 在一串的binary lut网络中插入一层交换各个channel之间的数据生成新的相同数量的channel
@ -63,3 +51,4 @@ grad_output output input exp_grad grad_input
3. Repeat的反向由Lut统一处理而不是pytorch自动反向可能修复了一些维度处理的错误
1. 经过这个改动后把grad_input计算回归到原来的方式 grad_input = grad_output发现精度提升非常大
2. 原来的方式可能因为一些代码的bug导致的learning rate的设置也不敏感了, 权重的初始化值也不敏感了
* **增加全连接的映射Lut不能提高模型最终精度的问题**