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
69ee7e7a
Commit
69ee7e7a
authored
Aug 24, 2018
by
Artur Wojcik
Committed by
Scott Cyphers
Aug 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
onnx: fix CentOS compilation after Convolution PR merged (#1488)
Signed-off-by:
Artur Wojcik
<
artur.wojcik@intel.com
>
parent
559d5890
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
19 deletions
+19
-19
conv.cpp
src/ngraph/frontend/onnx_import/op/conv.cpp
+10
-10
onnx_import.cpp
test/onnx_import.cpp
+9
-9
No files found.
src/ngraph/frontend/onnx_import/op/conv.cpp
View file @
69ee7e7a
...
...
@@ -118,14 +118,14 @@ namespace ngraph
std
::
to_string
(
groups
)};
}
auto
strides
{
attribute
::
get_strides
(
node
)}
;
auto
dilations
{
attribute
::
get_dilations
(
node
)}
;
auto
paddings
{
attribute
::
get_pads
(
node
)}
;
const
auto
&
padding_below
{
paddings
.
first
}
;
const
auto
&
padding_above
{
paddings
.
second
}
;
auto
strides
=
attribute
::
get_strides
(
node
)
;
auto
dilations
=
attribute
::
get_dilations
(
node
)
;
auto
paddings
=
attribute
::
get_pads
(
node
)
;
const
auto
&
padding_below
=
paddings
.
first
;
const
auto
&
padding_above
=
paddings
.
second
;
auto
conv_node
{
make_ng_convolution
(
data
,
filters
,
strides
,
dilations
,
padding_below
,
padding_above
,
groups
)
}
;
auto
conv_node
=
make_ng_convolution
(
data
,
filters
,
strides
,
dilations
,
padding_below
,
padding_above
,
groups
);
// no bias param
if
(
inputs
.
size
()
<
3
)
...
...
@@ -133,11 +133,11 @@ namespace ngraph
return
{
conv_node
};
}
auto
bias
{
inputs
.
at
(
2
)}
;
auto
bias
=
inputs
.
at
(
2
)
;
const
Shape
&
new_shape
=
conv_node
->
get_shape
();
auto
broadcasted_bias
{
std
::
make_shared
<
ngraph
::
op
::
Broadcast
>
(
bias
,
new_shape
,
calculate_broadcast_axes
(
new_shape
,
bias
->
get_shape
(),
1
))
}
;
auto
broadcasted_bias
=
std
::
make_shared
<
ngraph
::
op
::
Broadcast
>
(
bias
,
new_shape
,
calculate_broadcast_axes
(
new_shape
,
bias
->
get_shape
(),
1
));
return
{
std
::
make_shared
<
ngraph
::
op
::
Add
>
(
conv_node
,
broadcasted_bias
)};
}
...
...
test/onnx_import.cpp
View file @
69ee7e7a
...
...
@@ -133,8 +133,8 @@ namespace
TEST
(
onnx
,
mode_conv2d_strides_padding
)
{
// Convolution with strides=2 and padding=1
auto
function
{
ngraph
::
onnx_import
::
import_onnx_function
(
ngraph
::
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/conv_with_strides_padding.onnx"
))
}
;
auto
function
=
ngraph
::
onnx_import
::
import_onnx_function
(
ngraph
::
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/conv_with_strides_padding.onnx"
));
// (1, 1, 4, 3)
auto
expected_output
=
ngraph
::
test
::
NDArray
<
float
,
4
>
({{{{
12.
f
,
27.
f
,
24.
f
},
...
...
@@ -143,37 +143,37 @@ TEST(onnx, mode_conv2d_strides_padding)
{
112.
f
,
177.
f
,
124.
f
}}}})
.
get_vector
();
auto
result
{
conv2d_execute
(
function
)}
;
auto
result
=
conv2d_execute
(
function
)
;
EXPECT_EQ
(
expected_output
,
result
.
front
());
}
TEST
(
onnx
,
model_conv2d_strides_no_padding
)
{
// Convolution with strides=2 and padding=1
auto
function
{
ngraph
::
onnx_import
::
import_onnx_function
(
ngraph
::
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/conv_with_strides_no_padding.onnx"
))
}
;
auto
function
=
ngraph
::
onnx_import
::
import_onnx_function
(
ngraph
::
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/conv_with_strides_no_padding.onnx"
));
// (1, 1, 3, 2)
auto
expected_output
=
ngraph
::
test
::
NDArray
<
float
,
4
>
({{{{
54.
f
,
72.
f
},
{
144.
f
,
162.
f
},
{
234.
f
,
252.
f
}}}})
.
get_vector
();
auto
result
{
conv2d_execute
(
function
)}
;
auto
result
=
conv2d_execute
(
function
)
;
EXPECT_EQ
(
expected_output
,
result
.
front
());
}
TEST
(
onnx
,
model_conv2d_strides_assymetric_padding
)
{
// Convolution with strides=2 and padding=1
auto
function
{
ngraph
::
onnx_import
::
import_onnx_function
(
ngraph
::
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/conv_with_strides_and_asymmetric_padding.onnx"
))
}
;
auto
function
=
ngraph
::
onnx_import
::
import_onnx_function
(
ngraph
::
file_util
::
path_join
(
SERIALIZED_ZOO
,
"onnx/conv_with_strides_and_asymmetric_padding.onnx"
));
// (1, 1, 4, 2)
auto
expected_output
=
ngraph
::
test
::
NDArray
<
float
,
4
>
(
{{{{
21.
f
,
33.
f
},
{
99.
f
,
117.
f
},
{
189.
f
,
207.
f
},
{
171.
f
,
183.
f
}}}})
.
get_vector
();
auto
result
{
conv2d_execute
(
function
)}
;
auto
result
=
conv2d_execute
(
function
)
;
EXPECT_EQ
(
expected_output
,
result
.
front
());
}
...
...
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