Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
2139dc75
Commit
2139dc75
authored
6 years ago
by
tsocha
Committed by
Michał Karzyński
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ONNX] Add support for negative calculated padding (#2521)
parent
23f29e88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
conv_transpose.cpp
src/ngraph/frontend/onnx_import/op/conv_transpose.cpp
+13
-9
No files found.
src/ngraph/frontend/onnx_import/op/conv_transpose.cpp
View file @
2139dc75
...
...
@@ -171,15 +171,19 @@ namespace ngraph
}
for
(
int
i
=
0
;
i
<
num_spatial_dims
;
++
i
)
{
padding_below
[
i
]
=
(
strides
[
i
]
*
(
data_shape
[
i
+
2
]
-
1
)
+
dilations
[
i
]
*
(
weights_shape
[
i
+
2
]
-
1
)
-
data_dilation_strides
[
i
]
*
(
output_shape
[
i
]
-
output_padding
[
i
]
-
1
))
/
2
;
if
(
static_cast
<
int
>
(
padding_below
[
i
])
<
0
)
padding_below
[
i
]
=
strides
[
i
]
*
(
data_shape
[
i
+
2
]
-
1
)
+
dilations
[
i
]
*
(
weights_shape
[
i
+
2
]
-
1
)
-
data_dilation_strides
[
i
]
*
(
output_shape
[
i
]
-
output_padding
[
i
]
-
1
);
if
(
padding_below
[
i
]
<
0
)
{
output_padding
[
i
]
=
-
static_cast
<
int
>
(
padding_below
[
i
]);
padding_below
[
i
]
=
0
;
// (int) -9 / 2 = -5 but we need -4
// (int) -9 --> 9 / 2 = 4 --> -4
padding_below
[
i
]
=
-
(
-
padding_below
[
i
]
/
2
);
}
else
{
padding_below
[
i
]
/=
2
;
}
padding_above
[
i
]
=
padding_below
[
i
];
data_batch_shape
[
i
+
2
]
=
output_shape
[
i
];
...
...
@@ -187,7 +191,7 @@ namespace ngraph
}
else
{
for
(
int
i
=
0
;
i
<
num_spatial_dims
&&
output_shape
.
empty
()
;
++
i
)
for
(
int
i
=
0
;
i
<
num_spatial_dims
;
++
i
)
{
// Calculating spatial dims of data output shape for ngraph conv backprop op
// | s(ds-1) + d(ws-1) - pb - pa |
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment