Skip to content

tf-keras implementation of SNIP(Single-shot Network Pruning based on Connection Sensitivity)

License

Notifications You must be signed in to change notification settings

junhyukso/SNIP-tf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SNIP-tf

tf-keras implementation of SNIP(Single-shot Network Pruning based on Connection Sensitivity)

Usage

import tensorflow as tf
from SNIPtf.prune import make_prune_callback
...
(x_train,y_train) , (x_test,y_test) = ...

model = ...

# Prune 90% weight
# Feed Mini Batch to make pruning callback.
pc = make_prune_callback( 
  model,                                # model instance
  0.9  ,                                # Sparsity. 0~1 float
  tf.convert_to_tensor(x_train[1:10]) , # Feed Mini Batch. X
  tf.convert_to_tensor(y_train[1:10])   # Feed Mini Batch. Y
  )

# Train with pruning callback
model.fit( ...
           callbacks = [pc , ..]
          )

or see example.py

Algorithm

Note

This Implementation currently not reduce Train FLOPS.

About

tf-keras implementation of SNIP(Single-shot Network Pruning based on Connection Sensitivity)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages