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
c36e4980
Unverified
Commit
c36e4980
authored
Jun 28, 2019
by
Scott Cyphers
Committed by
GitHub
Jun 28, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3113 from NervanaSystems/rearhart/plaidml-tolerances
Adjust PlaidML test tolerances
parents
f5384c9e
7f02a5bc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
9 deletions
+61
-9
unit_test.manifest
src/ngraph/runtime/gpu/unit_test.manifest
+2
-0
CMakeLists.txt
test/CMakeLists.txt
+2
-0
backend_binary_elementwise.in.cpp
test/backend_binary_elementwise.in.cpp
+10
-0
backend_test.in.cpp
test/backend_test.in.cpp
+37
-9
backend_unary_elementwise.in.cpp
test/backend_unary_elementwise.in.cpp
+10
-0
No files found.
src/ngraph/runtime/gpu/unit_test.manifest
View file @
c36e4980
...
...
@@ -4,6 +4,8 @@ computation_reuse
dot_matrix_vector_int64
generate_mask
generate_mask2
# Gives inaccurate value
sigmoid_bprop_n1c1h4
# custom_mem is not implemented on GPU
tensorview_custom_mem
# integer is not supported by cuDNN on backward pooling
...
...
test/CMakeLists.txt
View file @
c36e4980
...
...
@@ -261,6 +261,8 @@ endif()
if
(
NGRAPH_PLAIDML_ENABLE
)
target_link_libraries
(
unit-test PRIVATE plaidml_backend
)
# Some PlaidML devices aren't so precise, so we increase the allowable tolerance.
target_compile_definitions
(
unit-test PRIVATE
"PlaidML_FLOAT_TOLERANCE_BITS=12"
)
endif
()
if
(
NGRAPH_TBB_ENABLE
)
...
...
test/backend_binary_elementwise.in.cpp
View file @
c36e4980
...
...
@@ -21,6 +21,16 @@
#include <random>
#include <string>
// clang-format off
#ifdef ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS
#define DEFAULT_FLOAT_TOLERANCE_BITS ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS
#endif
#ifdef ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS
#define DEFAULT_DOUBLE_TOLERANCE_BITS ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS
#endif
// clang-format on
#include "gtest/gtest.h"
#include "ngraph/ngraph.hpp"
#include "util/all_close.hpp"
...
...
test/backend_test.in.cpp
View file @
c36e4980
...
...
@@ -22,6 +22,16 @@
#include <string>
#include "gtest/gtest.h"
// clang-format off
#ifdef ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS
#define DEFAULT_FLOAT_TOLERANCE_BITS ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS
#endif
#ifdef ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS
#define DEFAULT_DOUBLE_TOLERANCE_BITS ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS
#endif
// clang-format on
#include "ngraph/autodiff/adjoints.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/log.hpp"
...
...
@@ -5184,12 +5194,17 @@ NGRAPH_TEST(${BACKEND_NAME}, sigmoid_n1c1h2w2)
shared_ptr
<
runtime
::
Tensor
>
a
=
backend
->
create_tensor
(
element
::
f32
,
input
->
get_shape
());
shared_ptr
<
runtime
::
Tensor
>
result
=
backend
->
create_tensor
(
element
::
f32
,
input
->
get_shape
());
vector
<
float
>
dataA
{
1.0
f
,
4.0
f
,
1.0
f
,
4.0
f
};
float
x1
=
1.0
f
;
float
x2
=
4.0
f
;
float
sigma1
=
1.0
f
/
(
1.0
f
+
std
::
exp
(
-
x1
));
float
sigma2
=
1.0
f
/
(
1.0
f
+
std
::
exp
(
-
x2
));
vector
<
float
>
dataA
{
x1
,
x2
,
x1
,
x2
};
copy_data
(
a
,
dataA
);
auto
handle
=
backend
->
compile
(
func
);
handle
->
call_with_validate
({
result
},
{
a
});
vector
<
float
>
expected
{
0.73105858
f
,
0.98201379
f
,
0.73105858
f
,
0.98201379
f
};
vector
<
float
>
expected
{
sigma1
,
sigma2
,
sigma1
,
sigma2
};
EXPECT_TRUE
(
test
::
all_close_f
(
read_vector
<
float
>
(
result
),
expected
));
}
...
...
@@ -5204,12 +5219,17 @@ NGRAPH_TEST(${BACKEND_NAME}, sigmoid_n1c1h4)
shared_ptr
<
runtime
::
Tensor
>
a
=
backend
->
create_tensor
(
element
::
f32
,
input
->
get_shape
());
shared_ptr
<
runtime
::
Tensor
>
result
=
backend
->
create_tensor
(
element
::
f32
,
input
->
get_shape
());
vector
<
float
>
dataA
{
1.0
f
,
4.0
f
,
1.0
f
,
4.0
f
};
float
x1
=
1.0
f
;
float
x2
=
4.0
f
;
float
sigma1
=
1.0
f
/
(
1.0
f
+
std
::
exp
(
-
x1
));
float
sigma2
=
1.0
f
/
(
1.0
f
+
std
::
exp
(
-
x2
));
vector
<
float
>
dataA
{
x1
,
x2
,
x1
,
x2
};
copy_data
(
a
,
dataA
);
auto
handle
=
backend
->
compile
(
func
);
handle
->
call_with_validate
({
result
},
{
a
});
vector
<
float
>
expected
{
0.73105858
f
,
0.98201379
f
,
0.73105858
f
,
0.98201379
f
};
vector
<
float
>
expected
{
sigma1
,
sigma2
,
sigma1
,
sigma2
};
EXPECT_TRUE
(
test
::
all_close_f
(
read_vector
<
float
>
(
result
),
expected
));
}
...
...
@@ -5225,16 +5245,24 @@ NGRAPH_TEST(${BACKEND_NAME}, sigmoid_bprop_n1c1h4)
shared_ptr
<
runtime
::
Tensor
>
b
=
backend
->
create_tensor
(
element
::
f32
,
delta
->
get_shape
());
shared_ptr
<
runtime
::
Tensor
>
result
=
backend
->
create_tensor
(
element
::
f32
,
input
->
get_shape
());
vector
<
float
>
dataA
{
1.0
f
,
4.0
f
,
1.0
f
,
4.0
f
};
vector
<
float
>
dataB
{
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
};
float
x1
=
1.0
f
;
float
x2
=
4.0
f
;
float
dt
=
1.0
f
;
float
sigma1
=
1.0
f
/
(
1.0
f
+
std
::
exp
(
-
x1
));
float
sigma2
=
1.0
f
/
(
1.0
f
+
std
::
exp
(
-
x2
));
float
bprop1
=
sigma1
*
(
1
-
sigma1
)
*
dt
;
float
bprop2
=
sigma2
*
(
1
-
sigma2
)
*
dt
;
vector
<
float
>
dataA
{
x1
,
x2
,
x1
,
x2
};
vector
<
float
>
dataB
{
dt
,
dt
,
dt
,
dt
};
copy_data
(
a
,
dataA
);
copy_data
(
b
,
dataB
);
auto
handle
=
backend
->
compile
(
func
);
handle
->
call_with_validate
({
result
},
{
a
,
b
});
vector
<
float
>
expected
{
0.196612
f
,
0.0176627
f
,
0.196612
f
,
0.0176627
f
};
EXPECT_TRUE
(
test
::
all_close
(
expected
,
read_vector
<
float
>
(
result
)));
vector
<
float
>
expected
{
bprop1
,
bprop2
,
bprop1
,
bprop2
};
EXPECT_TRUE
(
test
::
all_close
_f
(
expected
,
read_vector
<
float
>
(
result
)));
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
relu_2Dfprop
)
...
...
@@ -5540,7 +5568,7 @@ NGRAPH_TEST(${BACKEND_NAME}, softmax_underflow)
handle
->
call_with_validate
({
result
},
{
a
});
vector
<
float
>
expected
{
expf
(
low
)
/
d0
,
expf
(
1
)
/
d1
,
expf
(
2
)
/
d2
,
expf
(
3
)
/
d0
,
expf
(
4
)
/
d1
,
expf
(
5
)
/
d2
};
EXPECT_TRUE
(
test
::
all_close
(
expected
,
read_vector
<
float
>
(
result
)));
EXPECT_TRUE
(
test
::
all_close
_f
(
expected
,
read_vector
<
float
>
(
result
)));
}
NGRAPH_TEST
(
$
{
BACKEND_NAME
},
softmax_overflow
)
...
...
test/backend_unary_elementwise.in.cpp
View file @
c36e4980
...
...
@@ -21,6 +21,16 @@
#include <random>
#include <string>
// clang-format off
#ifdef ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS
#define DEFAULT_FLOAT_TOLERANCE_BITS ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS
#endif
#ifdef ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS
#define DEFAULT_DOUBLE_TOLERANCE_BITS ${BACKEND_NAME}_DOUBLE_TOLERANCE_BITS
#endif
// clang-format on
#include "gtest/gtest.h"
#include "ngraph/ngraph.hpp"
#include "util/all_close.hpp"
...
...
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