This repository contains the implementation for Active Shift Layer (ASL).
Please see the paper Constructing Fast Network through Deconstruction of Convolution.
This paper is accepted in NIPS 2018 as spotlight session (slide, poster)
The code is based on Tensorflow
Caffe implementation is also available at ASL-Caffe
Naive spatial convolution can be deconstructed into a shift layer and a 1x1 convolution.
This figure shows the basic concept of deconstruction.
For the efficient shift, we proposed active shift layer.
- Uses depthwise shift
- Introduced new shift parameters for each channel
- New shift parameters(alpha, beta) are learnable
Note that this code is tested only in the environment decribed below. Mismatched versions does not guarantee correct execution.
- Tensorflow 1.4.1
- Cuda 8.0
- g++ 4.9.3
- Edit CUDA_HOME in build.sh and build-spec for your GPU
- run >./build.sh
- If there is an error with cuda_config.h, run "cp ./lib/cuda_config.h $TF_INC/tensorflow/stream_executor/cuda/"
-
run >python test_forward_ASL.py
- It just shows the results of forwarding random tensor. You should not have any error message.
-
run >python test_backward_ASL.py
- You should get "OK" for 3 tests.
- import lib.active_shift2d_op as active_shift2d_op
- use active_shift2d_op.active_shift2d_op(input_tensor, shift_tensor, strides, paddings)
- Please see test_forward_ASL.py