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
4356b2cd
Commit
4356b2cd
authored
Jan 27, 2018
by
Jaikrishnan Menon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP
parent
6bd5db00
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
20 deletions
+37
-20
cpu_layout_descriptor.cpp
src/ngraph/runtime/cpu/cpu_layout_descriptor.cpp
+19
-2
cpu_layout_descriptor.hpp
src/ngraph/runtime/cpu/cpu_layout_descriptor.hpp
+1
-16
cpu_layout.cpp
src/ngraph/runtime/cpu/pass/cpu_layout.cpp
+17
-1
cpu_layout.hpp
src/ngraph/runtime/cpu/pass/cpu_layout.hpp
+0
-1
No files found.
src/ngraph/runtime/cpu/cpu_layout_descriptor.cpp
View file @
4356b2cd
...
...
@@ -24,8 +24,25 @@ namespace ngraph
const
AxisVector
LayoutDescriptor
::
Native4DAxisOrder
{
0
,
1
,
2
,
3
};
const
AxisVector
LayoutDescriptor
::
CHWNAxisOrder
{
1
,
2
,
3
,
0
};
size_t
LayoutDescriptor
::
get_index_offset
(
const
std
::
vector
<
size_t
>&
indices
)
LayoutDescriptor
::
LayoutDescriptor
(
const
ngraph
::
descriptor
::
TensorView
&
tv
,
const
AxisVector
&
tv_axis_order
)
:
TensorViewLayout
(
tv
)
,
axis_order
(
tv_axis_order
)
,
offset
(
0
)
,
size
(
ngraph
::
shape_size
(
tv
.
get_tensor_view_type
()
->
get_shape
()))
,
mkldnn_format
(
mkldnn_format_undef
)
{
if
(
tv_axis_order
==
Native2DAxisOrder
||
tv_axis_order
==
Native4DAxisOrder
)
{
strides
=
ngraph
::
row_major_strides
(
get_shape
());
}
else
{
throw
ngraph_error
(
"Axis ordering not handled yet"
);
}
}
size_t
LayoutDescriptor
::
get_index_offset
(
const
std
::
vector
<
size_t
>&
indices
)
{
if
(
indices
.
size
()
!=
strides
.
size
())
{
...
...
src/ngraph/runtime/cpu/cpu_layout_descriptor.hpp
View file @
4356b2cd
...
...
@@ -33,22 +33,7 @@ namespace ngraph
{
public
:
LayoutDescriptor
(
const
ngraph
::
descriptor
::
TensorView
&
tv
,
const
AxisVector
&
tv_axis_order
)
:
TensorViewLayout
(
tv
)
,
axis_order
(
tv_axis_order
)
,
offset
(
0
)
,
size
(
ngraph
::
shape_size
(
tv
.
get_tensor_view_type
()
->
get_shape
()))
,
mkldnn_format
(
mkldnn_format_undef
)
{
if
(
tv_axis_order
==
Native2DAxisOrder
||
tv_axis_order
==
Native4DAxisOrder
)
{
strides
=
ngraph
::
row_major_strides
(
get_shape
());
}
else
{
throw
ngraph_error
(
"Axis ordering not handled yet"
);
}
}
const
AxisVector
&
tv_axis_order
);
size_t
get_size
()
override
{
return
size
;
}
size_t
get_offset
()
const
{
return
offset
;
}
...
...
src/ngraph/runtime/cpu/pass/cpu_layout.cpp
View file @
4356b2cd
...
...
@@ -13,6 +13,8 @@
// ----------------------------------------------------------------------------
#include "cpu_layout.hpp"
#include "ngraph/descriptor/output.hpp"
#include "ngraph/runtime/cpu/cpu_layout_descriptor.hpp"
using
namespace
ngraph
::
runtime
::
cpu
::
pass
;
...
...
@@ -20,7 +22,21 @@ bool CPULayout::run_on_call_graph(const std::list<std::shared_ptr<Node>>& nodes)
{
for
(
const
auto
&
node
:
nodes
)
{
for
(
size_t
i
=
0
;
i
<
node
->
get_output_size
();
++
i
)
{
auto
tv
=
node
->
get_output_tensor_view
(
i
);
if
(
tv
->
get_tensor_view_layout
())
{
continue
;
}
auto
tvt
=
tv
.
get_tensor_view_type
();
auto
rank
=
tvt
->
get_shape
().
size
();
auto
layout
=
std
::
make_shared
<
ngraph
::
runtime
::
cpu
::
LayoutDescriptor
>
(
*
tv
);
tv
->
set_tensor_view_layout
(
layout
);
}
}
return
false
;
...
...
src/ngraph/runtime/cpu/pass/cpu_layout.hpp
View file @
4356b2cd
...
...
@@ -15,7 +15,6 @@
#pragma once
#include "ngraph/pass/pass.hpp"
#include "ngraph/runtime/cpu/cpu_layout_descriptor.hpp"
namespace
ngraph
{
...
...
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