未验证 提交 3a0f7d29 编写于 作者: J Jason 提交者: GitHub

Merge pull request #342 from Channingss/Conv

fix bug of Conv
...@@ -40,7 +40,7 @@ def _const_weight_or_none(node): ...@@ -40,7 +40,7 @@ def _const_weight_or_none(node):
return None return None
def get_same_padding(in_size, kernel_size, stride): def _get_same_padding(in_size, kernel_size, stride):
new_size = int(math.ceil(in_size * 1.0 / stride)) new_size = int(math.ceil(in_size * 1.0 / stride))
pad_size = (new_size - 1) * stride + kernel_size - in_size pad_size = (new_size - 1) * stride + kernel_size - in_size
pad0 = int(pad_size / 2) pad0 = int(pad_size / 2)
...@@ -1305,11 +1305,11 @@ class OpSet9(): ...@@ -1305,11 +1305,11 @@ class OpSet9():
paddings, val_x = self._pad_if_asymmetric(node, pads, val_x) paddings, val_x = self._pad_if_asymmetric(node, pads, val_x)
if auto_pad == "SAME_UPPER" or auto_pad == "SAME_LOWER": if auto_pad == "SAME_UPPER" or auto_pad == "SAME_LOWER":
pad_h = get_same_padding(input_shape[2], kernel_shape[0], pad_h = _get_same_padding(input_shape[2], kernel_shape[0],
strides[0]) strides[0])
pad_w = get_same_padding(input_shape[3], kernel_shape[1], pad_w = _get_same_padding(input_shape[3], kernel_shape[1],
strides[1]) strides[1])
attr = {"paddings": pad_h + pad_w, "pad_value": 0.0} paddings = pad_h + pad_w
attr = { attr = {
"num_filters": num_out_channels, "num_filters": num_out_channels,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册