Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Fix checking pad #1085

Merged
merged 3 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 4 additions & 4 deletions blueoil/converter/core/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,8 @@ def _check_consistency(self) -> None:
mW += f'\nThe weight format is {self._input_ops["W"].dimension}.'
self._assert(in_W == self.kernel_width, mW)
if self.kernel_index_H is not None and self.index_H is not None:
pad_H = self.pads[self.kernel_index_H] + \
self.pads[self.kernel_index_H + self._num_dimensions]
pad_H = self.pads[self.kernel_index_H * 2] + \
self.pads[self.kernel_index_H * 2 + 1]
stride_H = self.strides[self.kernel_index_H]
dilation_H = self.dilations[self.kernel_index_H]
# print(self.name, ' input dimension: ', self.input_ops['X'].dimension)
Expand All @@ -1068,8 +1068,8 @@ def _check_consistency(self) -> None:
print(f'mispadding height at {self.name}: {output_H_rest}')

if self.kernel_index_W is not None and self.index_W is not None:
pad_W = self.pads[self.kernel_index_W] + \
self.pads[self.kernel_index_W + self._num_dimensions]
pad_W = self.pads[self.kernel_index_W * 2] + \
self.pads[self.kernel_index_W * 2 + 1]
stride_W = self.strides[self.kernel_index_W]
dilation_W = self.dilations[self.kernel_index_W]
# print(self.name, ' input shape: ', self.input_ops['X'].shape)
Expand Down
2 changes: 1 addition & 1 deletion tests/converter/test_consistency_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_conv_consistency(self) -> None:
[1, 3, 3, 3],
Float32(),
input_ops,
pads=[1, 1, 2, 2],
pads=[1, 2, 1, 2],
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I can not understand this change clearly.
pad format is [top, bottom, left, right] and this line means using different padding value for top and buttom. right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

strides=[2, 2]
)

Expand Down