-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 the bug of conv2d #8551
Fix the bug of conv2d #8551
Conversation
python/paddle/v2/fluid/layers/nn.py
Outdated
@@ -1262,7 +1262,7 @@ def conv2d(input, | |||
raise ValueError("use_cudnn should be True or False") | |||
|
|||
input_shape = input.shape | |||
filter_shape = [num_filters, num_filter_channels] + filter_size | |||
filter_shape = [num_filters, num_filter_channels] + list(filter_size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add an "elif" after line 1256 to convert to list when it's a tuple? And throw a readable error for other unsupported types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your advice, I think we should define a convert_to_list
function in layers/utils.py
, just like what tensorflow does.
30cb201
to
c8ed768
Compare
… fixbug/conv2d_python
python/paddle/v2/fluid/layers/nn.py
Outdated
@@ -1434,29 +1433,24 @@ def sequence_last_step(input): | |||
def pool2d(input, | |||
pool_size, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pool_size also needs to be set None by default, since if set global_pooling = True
, there is no need to set pool_size
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
015c6e4
to
053dfbf
Compare
053dfbf
to
470d671
Compare
python/paddle/fluid/layers/utils.py
Outdated
# limitations under the License. | ||
|
||
|
||
def convert_to_list(value, n, name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe called "convert_to_int_list"? Since it only supports int types? Or make the function more general to other types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! convert_to_list
can be written more generally, it can convert any numerical type to a list.
fix #8546