Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
3597dfb6
Commit
3597dfb6
authored
Jul 31, 2018
by
Sergei Grechanik
Committed by
Tianqi Chen
Jul 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NNVM] Fix gradients for broadcast_div (#1512)
parent
a195f8d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
nnvm/src/top/tensor/broadcast.cc
+1
-2
nnvm/tests/python/compiler/test_top_level4.py
+1
-1
No files found.
nnvm/src/top/tensor/broadcast.cc
View file @
3597dfb6
...
@@ -337,8 +337,7 @@ Example::
...
@@ -337,8 +337,7 @@ Example::
});
});
NodeEntry
dy
=
MakeNode
(
"broadcast_div"
,
n
->
attrs
.
name
+
"_drhs_div"
,
{
NodeEntry
dy
=
MakeNode
(
"broadcast_div"
,
n
->
attrs
.
name
+
"_drhs_div"
,
{
NodeEntry
{
n
,
0
,
0
},
NodeEntry
{
n
,
0
,
0
},
MakeNode
(
"__mul_scalar__"
,
n
->
attrs
.
name
+
"_rhs_by_two"
,
MakeNode
(
"negative"
,
n
->
attrs
.
name
+
"_rhs_neg"
,
{
n
->
inputs
[
1
]})
{
n
->
inputs
[
1
]},
{{
"scalar"
,
"2"
}})
});
});
NodeEntry
drhs
=
MakeNode
(
"collapse_sum"
,
n
->
attrs
.
name
+
"_drhs_sum"
,
{
NodeEntry
drhs
=
MakeNode
(
"collapse_sum"
,
n
->
attrs
.
name
+
"_drhs_sum"
,
{
MakeNode
(
"broadcast_mul"
,
n
->
attrs
.
name
+
"_drhs_mul"
,
{
dy
,
ograds
[
0
]
}),
MakeNode
(
"broadcast_mul"
,
n
->
attrs
.
name
+
"_drhs_mul"
,
{
dy
,
ograds
[
0
]
}),
...
...
nnvm/tests/python/compiler/test_top_level4.py
View file @
3597dfb6
...
@@ -268,7 +268,7 @@ def test_broadcast():
...
@@ -268,7 +268,7 @@ def test_broadcast():
y
=
sym
.
broadcast_div
(
a
,
b
)
y
=
sym
.
broadcast_div
(
a
,
b
)
def
_backward_div
(
head_grads
,
a
,
b
):
def
_backward_div
(
head_grads
,
a
,
b
):
da
=
head_grads
/
b
da
=
head_grads
/
b
db
=
_collapse
(
head_grads
*
a
/
(
2
*
b
**
2
)
)
db
=
_collapse
(
-
head_grads
*
a
/
b
**
2
)
return
da
,
db
return
da
,
db
helper
(
y
,
inputs
,
dtype
,
lambda
a
,
b
:
a
/
b
,
_backward_div
)
helper
(
y
,
inputs
,
dtype
,
lambda
a
,
b
:
a
/
b
,
_backward_div
)
...
...
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