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
73ba71a8
Commit
73ba71a8
authored
6 years ago
by
Adam Straw
Committed by
Robert Kimball
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove TensorFlow rounding mode HALF_AWAY_FROM_ZERO (#2047)
parent
2cf9e4b2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
3 additions
and
10 deletions
+3
-10
quantize.hpp
src/ngraph/op/quantize.hpp
+0
-1
constant_folding.cpp
src/ngraph/pass/constant_folding.cpp
+1
-6
quantize.hpp
src/ngraph/runtime/reference/quantize.hpp
+1
-2
constant_folding.cpp
test/constant_folding.cpp
+1
-1
type_prop.cpp
test/type_prop.cpp
+0
-0
No files found.
src/ngraph/op/quantize.hpp
View file @
73ba71a8
...
...
@@ -37,7 +37,6 @@ namespace ngraph
// 2.5 -> 3
// -3.5 -> -4
ROUND_NEAREST_TOWARD_INFINITY
,
HALF_AWAY_FROM_ZERO
,
// TF mode for backward compatability
// round to nearest integer
// in case of two equidistant integers round toward zero e.g.
...
...
This diff is collapsed.
Click to expand it.
src/ngraph/pass/constant_folding.cpp
View file @
73ba71a8
...
...
@@ -567,7 +567,7 @@ void ngraph::pass::ConstantFolding::construct_constant_quantize()
make_shared
<
pattern
::
op
::
Label
>
(
element
::
f32
,
Shape
{
2
},
pattern
::
has_class
<
op
::
Constant
>
());
auto
q_scale
=
op
::
Constant
::
create
(
element
::
f32
,
Shape
{},
{
1
});
auto
q_offset
=
op
::
Constant
::
create
(
element
::
i8
,
Shape
{},
{
0
});
auto
mode
=
op
::
Quantize
::
RoundMode
::
HALF_AWAY_FROM_ZERO
;
auto
mode
=
op
::
Quantize
::
RoundMode
::
ROUND_NEAREST_TOWARD_INFINITY
;
auto
quant_op
=
make_shared
<
op
::
Quantize
>
(
constant_label
,
q_scale
,
q_offset
,
element
::
i8
,
AxisSet
{},
mode
);
auto
quant
=
make_shared
<
pattern
::
op
::
Label
>
(
quant_op
,
nullptr
,
NodeVector
{
quant_op
});
...
...
@@ -592,11 +592,6 @@ void ngraph::pass::ConstantFolding::construct_constant_quantize()
return
false
;
}
if
(
quantize_op
->
get_round_mode
()
!=
op
::
Quantize
::
RoundMode
::
HALF_AWAY_FROM_ZERO
)
{
return
false
;
}
if
(
type
==
element
::
u8
)
{
replace_node
(
...
...
This diff is collapsed.
Click to expand it.
src/ngraph/runtime/reference/quantize.hpp
View file @
73ba71a8
...
...
@@ -47,8 +47,7 @@ namespace ngraph
scale
[
scale_offset_transform
.
index
(
scale_offset_coord
)];
// round
if
(
round_mode
==
op
::
Quantize
::
RoundMode
::
ROUND_NEAREST_TOWARD_INFINITY
||
round_mode
==
op
::
Quantize
::
RoundMode
::
HALF_AWAY_FROM_ZERO
)
if
(
round_mode
==
op
::
Quantize
::
RoundMode
::
ROUND_NEAREST_TOWARD_INFINITY
)
{
auto
abs_qvalue
=
std
::
fabs
(
qvalue
);
auto
abs_qvalue_toward_inf
=
std
::
floor
(
abs_qvalue
+
0.5
);
...
...
This diff is collapsed.
Click to expand it.
test/constant_folding.cpp
View file @
73ba71a8
...
...
@@ -265,7 +265,7 @@ TEST(constant_folding, const_quantize)
auto
constant
=
op
::
Constant
::
create
(
element
::
f32
,
input_shape
,
values_in
);
auto
scale
=
op
::
Constant
::
create
(
element
::
f32
,
scale_offset_shape
,
{
2
});
auto
offset
=
op
::
Constant
::
create
(
quant_type
,
scale_offset_shape
,
{
1
});
auto
mode
=
op
::
Quantize
::
RoundMode
::
HALF_AWAY_FROM_ZERO
;
auto
mode
=
op
::
Quantize
::
RoundMode
::
ROUND_NEAREST_TOWARD_INFINITY
;
auto
quantize
=
make_shared
<
op
::
Quantize
>
(
constant
,
scale
,
offset
,
output_type
,
quantization_axes
,
mode
);
auto
f
=
make_shared
<
Function
>
(
quantize
,
op
::
ParameterVector
{});
...
...
This diff is collapsed.
Click to expand it.
test/type_prop.cpp
View file @
73ba71a8
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