Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
40951769
P
PaddleSlim
项目概览
PaddlePaddle
/
PaddleSlim
1 年多 前同步成功
通知
51
Star
1434
Fork
344
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
16
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSlim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
16
合并请求
16
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
40951769
编写于
2月 07, 2020
作者:
W
wanghaoshuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Init travis.
上级
b352e44f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
60 addition
and
6 deletion
+60
-6
.travis.yml
.travis.yml
+34
-0
.travis/precommit.sh
.travis/precommit.sh
+21
-0
tests/test_flops.py
tests/test_flops.py
+2
-1
tests/test_sensitivity.py
tests/test_sensitivity.py
+3
-5
未找到文件。
.travis.yml
0 → 100644
浏览文件 @
40951769
language
:
python
cache
:
ccache
sudo
:
required
dist
:
trusty
services
:
-
docker
os
:
-
linux
env
:
-
JOB=PRE_COMMIT
addons
:
apt
:
packages
:
-
git
-
python
-
python-pip
-
python2.7-dev
ssh_known_hosts
:
13.229.163.131
before_install
:
-
sudo pip install -U virtualenv pre-commit pip
-
docker pull paddlepaddle/paddle:latest
script
:
-
exit_code=0
-
.travis/precommit.sh || exit_code=((exitcode|? ))
-
docker run -i --rm -v "$PWD:/py_unittest" paddlepaddle/paddle:latest /bin/bash -c
'cd /py_unittest; sh .travis/unittest.sh' || exit_code=((exitcode|? ))
-
if [ $exit_code -eq 0 ]; then
true
; else exit 1; fi;
notifications
:
email
:
on_success
:
change
on_failure
:
always
.travis/precommit.sh
0 → 100644
浏览文件 @
40951769
#!/bin/bash
function
abort
(){
echo
"Your commit not fit PaddleSlim code style"
1>&2
echo
"Please use pre-commit scripts to auto-format your code"
1>&2
exit
1
}
trap
'abort'
0
set
-e
cd
`
dirname
$0
`
cd
..
export
PATH
=
/usr/bin:
$PATH
pre-commit
install
if
!
pre-commit run
-a
;
then
ls
-lh
git diff
--exit-code
exit
1
fi
trap
: 0
tests/test_flops.py
浏览文件 @
40951769
...
...
@@ -33,7 +33,8 @@ class TestPrune(unittest.TestCase):
sum2
=
conv4
+
sum1
conv5
=
conv_bn_layer
(
sum2
,
8
,
3
,
"conv5"
)
conv6
=
conv_bn_layer
(
conv5
,
8
,
3
,
"conv6"
)
self
.
assertTrue
(
1597440
==
flops
(
main_program
))
print
flops
(
main_program
)
self
.
assertTrue
(
792576
==
flops
(
main_program
))
if
__name__
==
'__main__'
:
...
...
tests/test_sensitivity.py
浏览文件 @
40951769
...
...
@@ -17,7 +17,7 @@ import unittest
import
numpy
import
paddle
import
paddle.fluid
as
fluid
from
paddleslim.
analysis
import
sensitivity
from
paddleslim.
prune
import
sensitivity
from
layers
import
conv_bn_layer
...
...
@@ -46,13 +46,12 @@ class TestSensitivity(unittest.TestCase):
val_reader
=
paddle
.
batch
(
paddle
.
dataset
.
mnist
.
test
(),
batch_size
=
128
)
def
eval_func
(
program
,
scope
):
def
eval_func
(
program
):
feeder
=
fluid
.
DataFeeder
(
feed_list
=
[
'image'
,
'label'
],
place
=
place
,
program
=
program
)
acc_set
=
[]
for
data
in
val_reader
():
acc_np
=
exe
.
run
(
program
=
program
,
scope
=
scope
,
feed
=
feeder
.
feed
(
data
),
fetch_list
=
[
acc_top1
])
acc_set
.
append
(
float
(
acc_np
[
0
]))
...
...
@@ -60,8 +59,7 @@ class TestSensitivity(unittest.TestCase):
print
(
"acc_val_mean: {}"
.
format
(
acc_val_mean
))
return
acc_val_mean
sensitivity
(
eval_program
,
fluid
.
global_scope
(),
place
,
[
"conv4_weights"
],
eval_func
,
sensitivity
(
eval_program
,
place
,
[
"conv4_weights"
],
eval_func
,
"./sensitivities_file"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录