Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in config_parse.py when batch_norm layer is used in RecurrentLayerGroup #966

Merged
merged 5 commits into from
Dec 21, 2016
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions python/paddle/trainer/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,12 @@ def __init__(
is_static=None,
is_shared=None,
update_hooks=None,
input_layer_argument=None, ):
input_layer_argument=None,
not_make_layer_name_in_submodel=None, ):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请问这个变量到底之bool型的还是一个指针呀?

python经常把默认参数设置成None是有原因的,参考 http://effbot.org/zone/default-values.htm

对于简单类型,比如整数,bool型,那么默认值直接传就可以了。因为Python对于简单类型是值传递而不是引用传递。

self.add_keys(locals())
self.input_layer_name = MakeLayerNameInSubmodel(input_layer_name)
if not_make_layer_name_in_submodel:
self.input_layer_name = input_layer_name


# Define a projection for iexed layer
Expand Down Expand Up @@ -1848,7 +1851,8 @@ def __init__(self,
initial_std=0.0,
initial_mean=0.0,
is_static=True,
is_shared=is_shared, ))
is_shared=is_shared,
not_make_layer_name_in_submodel=True, ))

parallel_nn = bool(int(g_command_config_args.get("parallel_nn", 0)))
cudnn_version = int(g_command_config_args.get("cudnn_version", 0))
Expand Down Expand Up @@ -1880,7 +1884,7 @@ def __init__(self,
# when either of it is non-zero.
if input_layer.width != 0 or input_layer.height != 0:
self.set_cnn_layer(name, image_conf.img_size_y, image_conf.img_size,
image_conf.channels, True)
image_conf.channels, False)
else:
self.set_layer_size(input_layer.size)

Expand Down