Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
cd27e536
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
cd27e536
编写于
8月 02, 2018
作者:
M
minqiyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix python code in contrib
上级
d8ddd3b3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
17 deletion
+19
-17
CMakeLists.txt
CMakeLists.txt
+8
-8
cmake/cudnn.cmake
cmake/cudnn.cmake
+1
-0
python/paddle/fluid/contrib/__init__.py
python/paddle/fluid/contrib/__init__.py
+2
-2
python/paddle/fluid/contrib/decoder/__init__.py
python/paddle/fluid/contrib/decoder/__init__.py
+2
-2
python/paddle/fluid/contrib/decoder/beam_search_decoder.py
python/paddle/fluid/contrib/decoder/beam_search_decoder.py
+6
-5
未找到文件。
CMakeLists.txt
浏览文件 @
cd27e536
...
...
@@ -201,6 +201,14 @@ include(external/snappy) # download snappy
include
(
external/snappystream
)
include
(
external/threadpool
)
if
(
WITH_GPU
)
include
(
cuda
)
include
(
tensorrt
)
include
(
external/anakin
)
else
()
set
(
WITH_ANAKIN OFF CACHE STRING
"Anakin is valid only when GPU is set."
FORCE
)
endif
()
include
(
cudnn
)
# set cudnn libraries, must before configure
include
(
cupti
)
include
(
configure
)
# add paddle env configuration
...
...
@@ -229,14 +237,6 @@ set(EXTERNAL_LIBS
${
PYTHON_LIBRARIES
}
)
if
(
WITH_GPU
)
include
(
cuda
)
include
(
tensorrt
)
include
(
external/anakin
)
else
()
set
(
WITH_ANAKIN OFF CACHE STRING
"Anakin is valid only when GPU is set."
FORCE
)
endif
()
if
(
WITH_AMD_GPU
)
find_package
(
HIP
)
include
(
hip
)
...
...
cmake/cudnn.cmake
浏览文件 @
cd27e536
...
...
@@ -21,6 +21,7 @@ list(APPEND CUDNN_CHECK_LIBRARY_DIRS
${
CUDNN_ROOT
}
/lib64
${
CUDNN_ROOT
}
/lib
${
CUDNN_ROOT
}
/lib/
${
TARGET_ARCH
}
-linux-gnu
${
CUDNN_ROOT
}
/local/cuda-
${
CUDA_VERSION
}
/targets/
${
TARGET_ARCH
}
-linux/lib/
$ENV{CUDNN_ROOT}
$ENV{CUDNN_ROOT}/lib64
$ENV{CUDNN_ROOT}/lib
...
...
python/paddle/fluid/contrib/__init__.py
浏览文件 @
cd27e536
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
decoder
from
decoder
import
*
from
.
import
decoder
from
.
decoder
import
*
__all__
=
decoder
.
__all__
python/paddle/fluid/contrib/decoder/__init__.py
浏览文件 @
cd27e536
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
beam_search_decoder
from
beam_search_decoder
import
*
from
.
import
beam_search_decoder
from
.
beam_search_decoder
import
*
__all__
=
beam_search_decoder
.
__all__
python/paddle/fluid/contrib/decoder/beam_search_decoder.py
浏览文件 @
cd27e536
...
...
@@ -191,7 +191,7 @@ class StateCell(object):
self
.
_helper
=
LayerHelper
(
'state_cell'
,
name
=
name
)
self
.
_cur_states
=
{}
self
.
_state_names
=
[]
for
state_name
,
state
in
s
tates
.
items
(
):
for
state_name
,
state
in
s
ix
.
iteritems
(
states
):
if
not
isinstance
(
state
,
InitState
):
raise
ValueError
(
'state must be an InitState object.'
)
self
.
_cur_states
[
state_name
]
=
state
...
...
@@ -346,7 +346,7 @@ class StateCell(object):
if
self
.
_in_decoder
and
not
self
.
_switched_decoder
:
self
.
_switch_decoder
()
for
input_name
,
input_value
in
inputs
.
items
(
):
for
input_name
,
input_value
in
six
.
iteritems
(
inputs
):
if
input_name
not
in
self
.
_inputs
:
raise
ValueError
(
'Unknown input %s. '
'Please make sure %s in input '
...
...
@@ -361,7 +361,7 @@ class StateCell(object):
if
self
.
_in_decoder
and
not
self
.
_switched_decoder
:
self
.
_switched_decoder
()
for
state_name
,
decoder_state
in
s
elf
.
_states_holder
.
items
(
):
for
state_name
,
decoder_state
in
s
ix
.
iteritems
(
self
.
_states_holder
):
if
id
(
self
.
_cur_decoder_obj
)
not
in
decoder_state
:
raise
ValueError
(
'Unknown decoder object, please make sure '
'switch_decoder been invoked.'
)
...
...
@@ -671,7 +671,7 @@ class BeamSearchDecoder(object):
feed_dict
=
{}
update_dict
=
{}
for
init_var_name
,
init_var
in
s
elf
.
_input_var_dict
.
items
(
):
for
init_var_name
,
init_var
in
s
ix
.
iteritems
(
self
.
_input_var_dict
):
if
init_var_name
not
in
self
.
state_cell
.
_inputs
:
raise
ValueError
(
'Variable '
+
init_var_name
+
' not found in StateCell!
\n
'
)
...
...
@@ -721,7 +721,8 @@ class BeamSearchDecoder(object):
self
.
state_cell
.
update_states
()
self
.
update_array
(
prev_ids
,
selected_ids
)
self
.
update_array
(
prev_scores
,
selected_scores
)
for
update_name
,
var_to_update
in
update_dict
.
items
():
for
update_name
,
var_to_update
in
six
.
iteritems
(
update_dict
):
self
.
update_array
(
var_to_update
,
feed_dict
[
update_name
])
def
read_array
(
self
,
init
,
is_ids
=
False
,
is_scores
=
False
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录