Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
a128eb7b
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a128eb7b
编写于
10月 31, 2017
作者:
Q
Qiao Longfei
提交者:
GitHub
10月 31, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improve unique_name, uniq id is related to prefix (#5223)
* improve unique_name, uniq id is related to prefix * fix join
上级
8d1ad97b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
8 deletion
+10
-8
paddle/pybind/pybind.cc
paddle/pybind/pybind.cc
+4
-3
python/paddle/v2/framework/framework.py
python/paddle/v2/framework/framework.py
+3
-2
python/paddle/v2/framework/layer_helper.py
python/paddle/v2/framework/layer_helper.py
+1
-1
python/paddle/v2/framework/tests/test_image_classification_layer.py
...dle/v2/framework/tests/test_image_classification_layer.py
+2
-2
未找到文件。
paddle/pybind/pybind.cc
浏览文件 @
a128eb7b
...
...
@@ -15,6 +15,7 @@ limitations under the License. */
#include "paddle/pybind/protobuf.h"
#include <mutex> // for call_once
#include <unordered_map>
#include "gflags/gflags.h"
#include "paddle/framework/backward.h"
#include "paddle/framework/executor.h"
...
...
@@ -42,9 +43,9 @@ limitations under the License. */
namespace
paddle
{
namespace
pybind
{
static
size_t
UniqueIntegerGenerator
()
{
static
std
::
atomic
<
size_t
>
generator
;
return
generator
.
fetch_add
(
1
);
static
size_t
UniqueIntegerGenerator
(
const
std
::
string
&
prefix
)
{
static
std
::
unordered_map
<
std
::
string
,
std
::
atomic
<
size_t
>>
generators
;
return
generator
s
[
prefix
]
.
fetch_add
(
1
);
}
std
::
once_flag
gflags_init_flag
;
...
...
python/paddle/v2/framework/framework.py
浏览文件 @
a128eb7b
...
...
@@ -119,8 +119,9 @@ class Variable(object):
@
staticmethod
def
_unique_var_name_
():
uid
=
core
.
unique_integer
()
# unique during whole process.
return
"_generated_var_%d"
%
uid
prefix
=
"_generated_var"
uid
=
core
.
unique_integer
(
prefix
)
# unique during whole process.
return
"_"
.
join
([
prefix
,
str
(
uid
)])
@
staticmethod
def
_convert_np_dtype_to_dtype_
(
np_dtype
):
...
...
python/paddle/v2/framework/layer_helper.py
浏览文件 @
a128eb7b
...
...
@@ -8,7 +8,7 @@ from paddle.v2.framework.framework import Variable, g_program, \
def
unique_name
(
prefix
):
uid
=
core
.
unique_integer
()
# unique during whole process.
uid
=
core
.
unique_integer
(
prefix
)
# unique during whole process.
return
"_"
.
join
([
prefix
,
str
(
uid
)])
...
...
python/paddle/v2/framework/tests/test_image_classification_layer.py
浏览文件 @
a128eb7b
...
...
@@ -37,7 +37,7 @@ class TestLayer(unittest.TestCase):
layers
.
batch_norm
(
input
=
images
,
program
=
program
,
init_program
=
init_program
)
#print str(program)
#
print str(program)
def
test_dropout_layer
(
self
):
program
=
Program
()
...
...
@@ -53,7 +53,7 @@ class TestLayer(unittest.TestCase):
program
=
program
,
init_program
=
init_program
)
#print str(program)
#
print str(program)
def
test_img_conv_group
(
self
):
program
=
Program
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录