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
49349a57
Unverified
Commit
49349a57
authored
Apr 06, 2020
by
Robert Kimball
Committed by
GitHub
Apr 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pretty format for opt_kernels (#4492)
Co-authored-by:
Sang Ik Lee
<
sang.ik.lee@intel.com
>
parent
b007440a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
24 deletions
+59
-24
broadcast.hpp
src/ngraph/runtime/opt_kernel/broadcast.hpp
+35
-11
reshape.hpp
src/ngraph/runtime/opt_kernel/reshape.hpp
+24
-13
No files found.
src/ngraph/runtime/opt_kernel/broadcast.hpp
View file @
49349a57
...
...
@@ -40,7 +40,11 @@ namespace ngraph
{
for
(
index
[
1
]
=
0
;
index
[
1
]
<
out_shape
[
1
];
++
index
[
1
])
{
out
[
index
[
0
]
*
out_strides
[
0
]
+
index
[
1
]]
=
in
[
in_index
];
// clang-format off
out
[
index
[
0
]
*
out_strides
[
0
]
+
index
[
1
]]
=
in
[
in_index
];
// clang-format on
}
}
}
...
...
@@ -59,8 +63,12 @@ namespace ngraph
{
for
(
index
[
2
]
=
0
;
index
[
2
]
<
out_shape
[
2
];
++
index
[
2
])
{
out
[
index
[
0
]
*
out_strides
[
0
]
+
index
[
1
]
*
out_strides
[
1
]
+
index
[
2
]]
=
in
[
in_index
];
// clang-format off
out
[
index
[
0
]
*
out_strides
[
0
]
+
index
[
1
]
*
out_strides
[
1
]
+
index
[
2
]]
=
in
[
in_index
];
// clang-format on
}
}
}
...
...
@@ -81,8 +89,13 @@ namespace ngraph
{
for
(
index
[
3
]
=
0
;
index
[
3
]
<
out_shape
[
3
];
++
index
[
3
])
{
out
[
index
[
0
]
*
out_strides
[
0
]
+
index
[
1
]
*
out_strides
[
1
]
+
index
[
2
]
*
out_strides
[
2
]
+
index
[
3
]]
=
in
[
in_index
];
// clang-format off
out
[
index
[
0
]
*
out_strides
[
0
]
+
index
[
1
]
*
out_strides
[
1
]
+
index
[
2
]
*
out_strides
[
2
]
+
index
[
3
]]
=
in
[
in_index
];
// clang-format on
}
}
}
...
...
@@ -106,9 +119,14 @@ namespace ngraph
{
for
(
index
[
4
]
=
0
;
index
[
4
]
<
out_shape
[
4
];
++
index
[
4
])
{
out
[
index
[
0
]
*
out_strides
[
0
]
+
index
[
1
]
*
out_strides
[
1
]
+
index
[
2
]
*
out_strides
[
2
]
+
index
[
3
]
*
out_strides
[
3
]
+
index
[
4
]]
=
in
[
in_index
];
// clang-format off
out
[
index
[
0
]
*
out_strides
[
0
]
+
index
[
1
]
*
out_strides
[
1
]
+
index
[
2
]
*
out_strides
[
2
]
+
index
[
3
]
*
out_strides
[
3
]
+
index
[
4
]]
=
in
[
in_index
];
// clang-format on
}
}
}
...
...
@@ -135,9 +153,15 @@ namespace ngraph
{
for
(
index
[
5
]
=
0
;
index
[
5
]
<
out_shape
[
5
];
++
index
[
5
])
{
out
[
index
[
0
]
*
out_strides
[
0
]
+
index
[
1
]
*
out_strides
[
1
]
+
index
[
2
]
*
out_strides
[
2
]
+
index
[
3
]
*
out_strides
[
3
]
+
index
[
4
]
*
out_strides
[
4
]
+
index
[
5
]]
=
in
[
in_index
];
// clang-format off
out
[
index
[
0
]
*
out_strides
[
0
]
+
index
[
1
]
*
out_strides
[
1
]
+
index
[
2
]
*
out_strides
[
2
]
+
index
[
3
]
*
out_strides
[
3
]
+
index
[
4
]
*
out_strides
[
4
]
+
index
[
5
]]
=
in
[
in_index
];
// clang-format on
}
}
}
...
...
src/ngraph/runtime/opt_kernel/reshape.hpp
View file @
49349a57
...
...
@@ -76,7 +76,10 @@ namespace ngraph
{
for
(
in_index
[
1
]
=
0
;
in_index
[
1
]
<
size
[
1
];
++
in_index
[
1
])
{
*
out
++
=
in
[
*
map_index
[
0
]
*
in_shape
[
1
]
+
*
map_index
[
1
]];
// clang-format off
*
out
++
=
in
[
*
map_index
[
0
]
*
in_shape
[
1
]
+
*
map_index
[
1
]];
// clang-format on
}
}
}
...
...
@@ -102,8 +105,11 @@ namespace ngraph
{
for
(
in_index
[
2
]
=
0
;
in_index
[
2
]
<
size
[
2
];
++
in_index
[
2
])
{
// clang-format off
*
out
++
=
in
[
*
map_index
[
0
]
*
in_shape
[
1
]
*
in_shape
[
2
]
+
*
map_index
[
1
]
*
in_shape
[
2
]
+
*
map_index
[
2
]];
*
map_index
[
1
]
*
in_shape
[
2
]
+
*
map_index
[
2
]];
// clang-format on
}
}
}
...
...
@@ -132,10 +138,13 @@ namespace ngraph
{
for
(
in_index
[
3
]
=
0
;
in_index
[
3
]
<
size
[
3
];
++
in_index
[
3
])
{
// clang-format off
*
out
++
=
in
[
*
map_index
[
0
]
*
in_shape
[
1
]
*
in_shape
[
2
]
*
in_shape
[
3
]
+
*
map_index
[
1
]
*
in_shape
[
2
]
*
in_shape
[
3
]
+
*
map_index
[
2
]
*
in_shape
[
3
]
+
*
map_index
[
3
]];
*
map_index
[
2
]
*
in_shape
[
3
]
+
*
map_index
[
3
]];
// clang-format on
}
}
}
...
...
@@ -167,12 +176,14 @@ namespace ngraph
{
for
(
in_index
[
4
]
=
0
;
in_index
[
4
]
<
size
[
4
];
++
in_index
[
4
])
{
// clang-format off
*
out
++
=
in
[
*
map_index
[
0
]
*
in_shape
[
1
]
*
in_shape
[
2
]
*
in_shape
[
3
]
*
in_shape
[
4
]
+
in
[
*
map_index
[
0
]
*
in_shape
[
1
]
*
in_shape
[
2
]
*
in_shape
[
3
]
*
in_shape
[
4
]
+
*
map_index
[
1
]
*
in_shape
[
2
]
*
in_shape
[
3
]
*
in_shape
[
4
]
+
*
map_index
[
2
]
*
in_shape
[
3
]
*
in_shape
[
4
]
+
*
map_index
[
3
]
*
in_shape
[
4
]
+
*
map_index
[
4
]];
*
map_index
[
3
]
*
in_shape
[
4
]
+
*
map_index
[
4
]];
// clang-format on
}
}
}
...
...
@@ -207,14 +218,14 @@ namespace ngraph
{
for
(
in_index
[
5
]
=
0
;
in_index
[
5
]
<
size
[
5
];
++
in_index
[
5
])
{
*
out
++
=
in
[
*
map_index
[
0
]
*
in_shape
[
1
]
*
in_shape
[
2
]
*
in_shape
[
3
]
*
in_shape
[
4
]
*
in_shape
[
5
]
+
*
map_index
[
1
]
*
in_shape
[
2
]
*
in_shape
[
3
]
*
in_shape
[
4
]
*
in_shape
[
5
]
+
*
map_index
[
2
]
*
in_shape
[
3
]
*
in_shape
[
4
]
*
in_shape
[
5
]
+
// clang-format off
*
out
++
=
in
[
*
map_index
[
0
]
*
in_shape
[
1
]
*
in_shape
[
2
]
*
in_shape
[
3
]
*
in_shape
[
4
]
*
in_shape
[
5
]
+
*
map_index
[
1
]
*
in_shape
[
2
]
*
in_shape
[
3
]
*
in_shape
[
4
]
*
in_shape
[
5
]
+
*
map_index
[
2
]
*
in_shape
[
3
]
*
in_shape
[
4
]
*
in_shape
[
5
]
+
*
map_index
[
3
]
*
in_shape
[
4
]
*
in_shape
[
5
]
+
*
map_index
[
4
]
*
in_shape
[
5
]
+
*
map_index
[
5
]];
*
map_index
[
4
]
*
in_shape
[
5
]
+
*
map_index
[
5
]];
// clang-format on
}
}
}
...
...
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