allenai / allenai/dnw

pruning

未關閉
#6 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
138
分支
18
PR 合併指標
30 天內沒有已合併 PR

描述

class ChooseTopEdges(autograd.Function):
""" Chooses the top edges for the forwards pass but allows gradient flow to all edges in the backwards pass"""

@staticmethod
def forward(ctx, weight, prune_rate):
output = weight.clone()
_, idx = weight.flatten().abs().sort()
p = int(prune_rate * weight.numel())
flat_oup = output.flatten()
flat_oup[idx[:p]] = 0
return output

@staticmethod
def backward(ctx, grad_output):
return grad_output, None, None
Excuse me, although flat_oup is pruned because the element is set to zero, the return in forward is output. Does this play the role of pruning? @dirkgr @schmmd @iellenberger @danyaljj @danyaljj @MLatzke

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。