前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >三值网络--Trained Ternary Quantization

三值网络--Trained Ternary Quantization

作者头像
用户1148525
发布2019-05-26 11:38:38
1.5K0
发布2019-05-26 11:38:38
举报
文章被收录于专栏:机器学习、深度学习

Trained Ternary Quantization ICLR 2017 https://github.com/TropComplique/trained-ternary-quantization pytorch https://github.com/buaabai/Ternary-Weights-Network pytorch

传统的二值网络将权重 W 量化为 +1、-1; 三值网络 TWN (Ternary weight networks) 将权重W 量化为 {−W_l ,0,+W_l }

在这里插入图片描述
在这里插入图片描述

阈值的计算公式如下所示

在这里插入图片描述
在这里插入图片描述

本文提出了新的三值网络

在这里插入图片描述
在这里插入图片描述

positive and negative weights,三个不同的值用于表示三值网络,这个正负权值是通过网络学习得到的 对应的梯度计算如下

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

本文的阈值选择采用:

在这里插入图片描述
在这里插入图片描述

set t to 0.05 in experiments on CIFAR-10 and ImageNet dataset

The quantization roughly proceeds as follows.

  1. Train a model of your choice as usual (or take a trained model).
  2. Copy all full precision weights that you want to quantize. Then do the initial quantization: in the model replace them by ternary values {-1, 0, +1} using some heuristic.
  3. Repeat until convergence: 1). Make the forward pass with the quantized model. 使用量化后的网络进行前向计算 2). Compute gradients for the quantized model. 对量化网络进行梯度计算 3). Preprocess the gradients and apply them to the copy of full precision weights. 使用梯度更新网络模型的权重 4). Requantize the model using the changed full precision weights. 对新的权重进行量化
  4. Throw away the copy of full precision weights and use the quantized model.
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019年05月08日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档