tensorflow element pruning
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/model_pruning
기존 웨이트를 마스킹하는 방법을 사용, pruning.py가 제공함.
conv = tf.nn.conv2d( images, pruning.apply_mask(weights), stride, padding)
이렇게 감싸지 않고 이미 감싸진 funcion도 있음. layers.masked_conv2d 등 .
@ 하이퍼파라미터
- name
string타입, 디폴트 model_pruning
썸마리, 오피들 이 네임공간에 있게된다?
- begin_pruing_step
int 타입, 디폴트 0
글로발 스텝에서 프르닝 시작 적용
- end_pruning_step
int 타입, 디폴트 -1
글로발 스텝 프르닝 멈춤, -1이면 학습 끝까지
- do_not_prune
list string 타입, 디폴트 '', 프리닝 제외 레이어
- threshold_decay
float 타입, 디폴트 0.9
매그니튜드 트레숄드 줄이는 양 조절 펙터
- pruning_frequency
int 타입, 디폴트 10
얼마나 자주 마스크를 바꿔줄거냐
- nbins
int 타입, 디폴트 256
히스토그램 계산을 위한 빈의 개수
- block_height, block_width
int 타입, 디폴트 1
스파스 매트릭스에서 로우, 컬럼
- block_pooling_function
string 타입, 디폴트 AVG
pooling에 사용될 폴링 기법, AVG와 MAX 제공됨
- initial_sparsity, target_sparsity
float 타입, 디폴트 0, 0.5
- sparsity_function_begin_step, sparsity_function_end_step
int 타입, 디폴트 0, 100
글로벌 스텝 점진 스파스티펑션이 적용 되고 끝나는 스텝
- sparsity_function_exponent
float 타입, 디폴트 3.0
- 공식
s_t: the sparsity
s_f: target sparsity
s_i: initial sparsity
t_0: sparsity_function_begin_step
t: global step
a: sparsity_function_exponent
n: pruning_frequency
Delta : sparsity_function_begin_step 과 sparsity_function_end_step은 pruning_frequency로 나눠진다.
s_t = s_f+ (s_i - s_f)((1- (t-t_0)/nDelta)^a)