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
718e2ef1
Commit
718e2ef1
authored
Feb 23, 2019
by
Amy Zhuang
Committed by
Sang Ik Lee
Feb 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not allow builder to access tensor_data map directly. (#2494)
parent
f1c72364
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
23 deletions
+19
-23
argmax.cpp
src/ngraph/runtime/cpu/builder/argmax.cpp
+2
-3
argmin.cpp
src/ngraph/runtime/cpu/builder/argmin.cpp
+2
-3
embedding_lookup.cpp
src/ngraph/runtime/cpu/builder/embedding_lookup.cpp
+3
-4
quantization.cpp
src/ngraph/runtime/cpu/builder/quantization.cpp
+12
-12
cpu_external_function.hpp
src/ngraph/runtime/cpu/cpu_external_function.hpp
+0
-1
No files found.
src/ngraph/runtime/cpu/builder/argmax.cpp
View file @
718e2ef1
...
...
@@ -33,13 +33,12 @@ namespace ngraph
void
Builder
::
BUILDER_DECL
(
ngraph
::
op
::
ArgMax
)
{
auto
&
functors
=
external_function
->
get_functors
();
auto
&
tensor_data
=
external_function
->
get_tensor_data
();
const
ngraph
::
op
::
ArgMax
*
argmax
=
static_cast
<
const
ngraph
::
op
::
ArgMax
*>
(
node
);
CPUKernelFunctor
functor
;
auto
&
arg_tensor
=
tensor_data
[
args
[
0
].
get_name
()]
;
auto
&
out_tensor
=
tensor_data
[
out
[
0
].
get_name
()]
;
auto
&
arg_tensor
=
external_function
->
get_tensor_data
(
args
[
0
].
get_name
())
;
auto
&
out_tensor
=
external_function
->
get_tensor_data
(
out
[
0
].
get_name
())
;
if
(
out
[
0
].
get_element_type
()
!=
element
::
i64
&&
out
[
0
].
get_element_type
()
!=
element
::
i32
)
{
...
...
src/ngraph/runtime/cpu/builder/argmin.cpp
View file @
718e2ef1
...
...
@@ -33,13 +33,12 @@ namespace ngraph
void
Builder
::
BUILDER_DECL
(
ngraph
::
op
::
ArgMin
)
{
auto
&
functors
=
external_function
->
get_functors
();
auto
&
tensor_data
=
external_function
->
get_tensor_data
();
const
ngraph
::
op
::
ArgMin
*
argmin
=
static_cast
<
const
ngraph
::
op
::
ArgMin
*>
(
node
);
CPUKernelFunctor
functor
;
auto
&
arg_tensor
=
tensor_data
[
args
[
0
].
get_name
()]
;
auto
&
out_tensor
=
tensor_data
[
out
[
0
].
get_name
()]
;
auto
&
arg_tensor
=
external_function
->
get_tensor_data
(
args
[
0
].
get_name
())
;
auto
&
out_tensor
=
external_function
->
get_tensor_data
(
out
[
0
].
get_name
())
;
if
(
out
[
0
].
get_element_type
()
!=
element
::
i64
&&
out
[
0
].
get_element_type
()
!=
element
::
i32
)
{
...
...
src/ngraph/runtime/cpu/builder/embedding_lookup.cpp
View file @
718e2ef1
...
...
@@ -33,13 +33,12 @@ namespace ngraph
void
Builder
::
BUILDER_DECL
(
ngraph
::
op
::
EmbeddingLookup
)
{
auto
&
functors
=
external_function
->
get_functors
();
auto
&
tensor_data
=
external_function
->
get_tensor_data
();
CPUKernelFunctor
functor
;
auto
&
arg0_tensor
=
external_function
->
get_tensor_data
(
args
[
0
].
get_name
());
auto
&
arg1_tensor
=
external_function
->
get_tensor_data
(
args
[
1
].
get_name
());
auto
&
out_tensor
=
external_function
->
get_tensor_data
(
out
[
0
].
get_name
());
auto
&
arg0_tensor
=
tensor_data
[
args
[
0
].
get_name
()];
auto
&
arg1_tensor
=
tensor_data
[
args
[
1
].
get_name
()];
auto
&
out_tensor
=
tensor_data
[
out
[
0
].
get_name
()];
if
(
out
[
0
].
get_element_type
()
!=
element
::
f32
&&
out
[
0
].
get_element_type
()
!=
element
::
f64
)
{
...
...
src/ngraph/runtime/cpu/builder/quantization.cpp
View file @
718e2ef1
...
...
@@ -39,7 +39,6 @@ namespace ngraph
void
Builder
::
BUILDER_DECL
(
ngraph
::
op
::
Dequantize
)
{
auto
&
functors
=
external_function
->
get_functors
();
auto
&
tensor_data
=
external_function
->
get_tensor_data
();
const
ngraph
::
op
::
Dequantize
*
dequantize
=
static_cast
<
const
ngraph
::
op
::
Dequantize
*>
(
node
);
...
...
@@ -47,8 +46,9 @@ namespace ngraph
if
(
runtime
::
cpu
::
mkldnn_utils
::
use_mkldnn_kernel
(
node
))
{
auto
&
arg0_tensor
=
tensor_data
[
args
[
0
].
get_name
()];
auto
&
out_tensor
=
tensor_data
[
out
[
0
].
get_name
()];
auto
&
arg0_tensor
=
external_function
->
get_tensor_data
(
args
[
0
].
get_name
());
auto
&
out_tensor
=
external_function
->
get_tensor_data
(
out
[
0
].
get_name
());
auto
&
mkldnn_emitter
=
external_function
->
get_mkldnn_emitter
();
auto
input_desc
=
mkldnn_utils
::
get_input_mkldnn_md
(
node
,
0
);
auto
result_desc
=
mkldnn_utils
::
get_output_mkldnn_md
(
node
,
0
);
...
...
@@ -106,10 +106,11 @@ namespace ngraph
}
else
{
auto
&
arg0_tensor
=
tensor_data
[
args
[
0
].
get_name
()];
auto
&
arg1_tensor
=
tensor_data
[
args
[
1
].
get_name
()];
auto
&
arg2_tensor
=
tensor_data
[
args
[
2
].
get_name
()];
auto
&
out_tensor
=
tensor_data
[
out
[
0
].
get_name
()];
auto
&
arg0_tensor
=
external_function
->
get_tensor_data
(
args
[
0
].
get_name
());
auto
&
arg1_tensor
=
external_function
->
get_tensor_data
(
args
[
1
].
get_name
());
auto
&
arg2_tensor
=
external_function
->
get_tensor_data
(
args
[
2
].
get_name
());
auto
&
out_tensor
=
external_function
->
get_tensor_data
(
out
[
0
].
get_name
());
auto
arg0_shape
=
args
[
0
].
get_shape
();
auto
arg1_shape
=
args
[
1
].
get_shape
();
auto
daxes
=
dequantize
->
get_axes
();
...
...
@@ -306,16 +307,15 @@ namespace ngraph
else
{
auto
&
functors
=
external_function
->
get_functors
();
auto
&
tensor_data
=
external_function
->
get_tensor_data
();
const
ngraph
::
op
::
Quantize
*
quantize
=
static_cast
<
const
ngraph
::
op
::
Quantize
*>
(
node
);
CPUKernelFunctor
functor
;
auto
&
arg0_tensor
=
tensor_data
[
args
[
0
].
get_name
()]
;
auto
&
arg1_tensor
=
tensor_data
[
args
[
1
].
get_name
()]
;
auto
&
arg2_tensor
=
tensor_data
[
args
[
2
].
get_name
()]
;
auto
&
out_tensor
=
tensor_data
[
out
[
0
].
get_name
()]
;
auto
&
arg0_tensor
=
external_function
->
get_tensor_data
(
args
[
0
].
get_name
())
;
auto
&
arg1_tensor
=
external_function
->
get_tensor_data
(
args
[
1
].
get_name
())
;
auto
&
arg2_tensor
=
external_function
->
get_tensor_data
(
args
[
2
].
get_name
())
;
auto
&
out_tensor
=
external_function
->
get_tensor_data
(
out
[
0
].
get_name
())
;
auto
arg0_shape
=
args
[
0
].
get_shape
();
auto
arg1_shape
=
args
[
1
].
get_shape
();
...
...
src/ngraph/runtime/cpu/cpu_external_function.hpp
View file @
718e2ef1
...
...
@@ -132,7 +132,6 @@ namespace ngraph
static
constexpr
size_t
s_memory_pool_alignment
=
4096
;
std
::
vector
<
CPUKernelFunctor
>&
get_functors
()
{
return
functors
;
}
std
::
unordered_map
<
std
::
string
,
void
*>&
get_tensor_data
()
{
return
tensor_data
;
}
void
*&
get_tensor_data
(
const
std
::
string
&
name
);
std
::
function
<
void
(
CPURuntimeContext
*
,
std
::
vector
<
void
*>&
,
std
::
vector
<
void
*>&
)
>&
get_executor
()
...
...
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