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
88986222
Unverified
Commit
88986222
authored
Nov 02, 2017
by
Adam Procter
Committed by
GitHub
Nov 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #221 from NervanaSystems/aprocter/autodiff_nested_adds
Fix bug with multiple updates to adjoint map
parents
3970b477
a2ac4168
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
adjoints.cpp
src/ngraph/autodiff/adjoints.cpp
+1
-1
CMakeLists.txt
test/CMakeLists.txt
+1
-1
autodiff.cpp
test/autodiff.cpp
+22
-2
No files found.
src/ngraph/autodiff/adjoints.cpp
View file @
88986222
...
...
@@ -160,6 +160,6 @@ void autodiff::Adjoints::add_delta(const std::shared_ptr<Node>& x,
}
else
{
m_adjoint_map
.
insert
({
x
.
get
(),
std
::
make_shared
<
op
::
Add
>
(
adjoint_it
->
second
,
delta
)}
);
adjoint_it
->
second
=
std
::
make_shared
<
op
::
Add
>
(
adjoint_it
->
second
,
delta
);
}
}
test/CMakeLists.txt
View file @
88986222
...
...
@@ -22,6 +22,7 @@ include_directories(
)
set
(
SRC
autodiff.cpp
build_graph.cpp
eigen.cpp
execute.cpp
...
...
@@ -36,7 +37,6 @@ set (SRC
topological_sort.cpp
type_prop.cpp
util/all_close.cpp
util/autodiff.cpp
util/test_tools.cpp
util.cpp
uuid.cpp
...
...
test/
util/
autodiff.cpp
→
test/autodiff.cpp
View file @
88986222
...
...
@@ -19,12 +19,12 @@
#include "gtest/gtest.h"
#include "all_close.hpp"
#include "ngraph/autodiff/backprop_derivative.hpp"
#include "ngraph/autodiff/backprop_function.hpp"
#include "ngraph/autodiff/numeric_derivative.hpp"
#include "ngraph/ngraph.hpp"
#include "random.hpp"
#include "util/all_close.hpp"
#include "util/random.hpp"
using
namespace
std
;
using
namespace
ngraph
;
...
...
@@ -65,6 +65,26 @@ TEST(backwards, add)
manager
,
backend
,
make_graph
,
{
x0
,
x1
},
.01
f
,
.01
f
));
}
TEST
(
backwards
,
add_nested
)
{
auto
manager
=
runtime
::
Manager
::
get
(
"NGVM"
);
auto
backend
=
manager
->
allocate_backend
();
test
::
Uniform
<
element
::
Float32
>
rng
(
-
1.0
f
,
1.0
f
);
auto
shape
=
Shape
{
2
,
3
};
auto
x0
=
rng
.
initialize
(
backend
->
make_parameterized_tensor_view
<
element
::
Float32
>
(
shape
));
auto
x1
=
rng
.
initialize
(
backend
->
make_parameterized_tensor_view
<
element
::
Float32
>
(
shape
));
auto
make_graph
=
[
shape
]()
{
auto
X0
=
make_shared
<
op
::
Parameter
>
(
element
::
Float32
::
element_type
(),
shape
);
auto
X1
=
make_shared
<
op
::
Parameter
>
(
element
::
Float32
::
element_type
(),
shape
);
return
make_shared
<
Function
>
(
(
X0
+
X1
)
+
(
X1
+
X0
),
nullptr
,
std
::
vector
<
std
::
shared_ptr
<
op
::
Parameter
>>
{
X0
,
X1
});
};
EXPECT_TRUE
(
autodiff_numeric_compare
<
element
::
Float32
>
(
manager
,
backend
,
make_graph
,
{
x0
,
x1
},
.01
f
,
.01
f
));
}
TEST
(
backwards
,
broadcast0
)
{
auto
manager
=
runtime
::
Manager
::
get
(
"NGVM"
);
...
...
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