Skip to content

Adapting to the BatchNorm structure to support 3D data #3594

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

Conversation

chengduoZH
Copy link
Contributor

@chengduoZH chengduoZH commented Aug 21, 2017

fix #3597
Adapting to the BatchNorm structure to support 3D data

@chengduoZH chengduoZH requested a review from qingqing01 August 21, 2017 09:17
@chengduoZH chengduoZH force-pushed the Adapting_to_the_BatchNorm_structure_to_support_3D_data branch 2 times, most recently from 3cd0ec1 to 16bd861 Compare August 30, 2017 07:36
@chengduoZH chengduoZH force-pushed the Adapting_to_the_BatchNorm_structure_to_support_3D_data branch 2 times, most recently from 959ed40 to 965bd40 Compare August 30, 2017 16:40
@@ -16,4 +16,4 @@

if __name__ == '__main__':
parse_config_and_serialize(
'trainer_config_helpers/tests/layers_test_config.py', '')
'trainer_config_helpers/tests/configs/test_BatchNorm3D.py', '')
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not change this line. Add test_BatchNorm3D.py in the file python/paddle/trainer_config_helpers/tests/configs/file_list.sh.

And please merge 3DConv/3DPooling first, then update this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@chengduoZH chengduoZH force-pushed the Adapting_to_the_BatchNorm_structure_to_support_3D_data branch 2 times, most recently from d1247d6 to 2c8b5d8 Compare August 31, 2017 06:20
@chengduoZH chengduoZH force-pushed the Adapting_to_the_BatchNorm_structure_to_support_3D_data branch from 2c8b5d8 to 30c0df6 Compare August 31, 2017 07:20
@@ -515,7 +516,8 @@ message LayerConfig {
// for HuberRegressionLoss
optional double delta = 57 [ default = 1.0 ];

optional uint64 depth = 58 [ default = 1 ];
// for 3D data
optional double depth = 58 [ default = 1 ];
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use double?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, It has been fixed

@chengduoZH chengduoZH force-pushed the Adapting_to_the_BatchNorm_structure_to_support_3D_data branch from 9a93348 to fe06096 Compare September 4, 2017 09:02
@chengduoZH chengduoZH force-pushed the Adapting_to_the_BatchNorm_structure_to_support_3D_data branch from fe06096 to eaf23cb Compare September 4, 2017 09:03
Copy link
Contributor

@qingqing01 qingqing01 left a comment

Choose a reason for hiding this comment

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

I approve this PR. If there is any problem, we can fix in the feature.

self.set_layer_size(input_layer.size)

if len(self.inputs) > 1:
assert len(self.inputs) == 2
Copy link
Contributor

Choose a reason for hiding this comment

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

AddToLayer can support more than 2 inputs.

assert self.get_input_layer(0).width == self.get_input_layer(
input_index).width
assert self.get_input_layer(0).depth == self.get_input_layer(
input_index).depth
Copy link
Contributor

Choose a reason for hiding this comment

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

严格来说,对于Addto,我觉得只需要检测input_layer.size相等即可。

input_layer = self.get_input_layer(input_index)
input = self.inputs[input_index]
if self.config.size == 0:
size += input_layer.size

self.set_layer_height_width(self.get_input_layer(0).height, \
self.get_input_layer(0).width)
self.set_layer_depth(self.get_input_layer(0).depth)
Copy link
Contributor

Choose a reason for hiding this comment

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

实际上不只Python这边需要对AddtoLayer ConcatLayer设置height width depth。C++的实现也需要set一下,这样才能支持变长输入。

@chengduoZH chengduoZH merged commit 0be3494 into PaddlePaddle:develop Sep 9, 2017
heavengate pushed a commit to heavengate/Paddle that referenced this pull request Aug 16, 2021
* fix_install_docs

* fix_install_docs2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support 3-Dimensional BatchNorm
2 participants