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
f1e0a55a
Commit
f1e0a55a
authored
Feb 08, 2018
by
Yao Wang
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move dense compute back to python (#364)
parent
5884cd01
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
15 deletions
+7
-15
nnvm/python/nnvm/top/nn.py
+7
-0
nnvm/src/top/nn/nn.cc
+0
-15
No files found.
nnvm/python/nnvm/top/nn.py
View file @
f1e0a55a
...
@@ -51,6 +51,13 @@ reg.register_pattern("log_softmax", OpPattern.OPAQUE)
...
@@ -51,6 +51,13 @@ reg.register_pattern("log_softmax", OpPattern.OPAQUE)
# dense
# dense
@reg.register_compute
(
"dense"
)
def
compute_dense
(
attrs
,
inputs
,
_
):
"""Compute definition of dense"""
if
attrs
.
get_bool
(
"use_bias"
):
return
topi
.
nn
.
dense
(
inputs
[
0
],
inputs
[
1
],
bias
=
inputs
[
2
])
return
topi
.
nn
.
dense
(
inputs
[
0
],
inputs
[
1
])
@reg.register_schedule
(
"dense"
)
@reg.register_schedule
(
"dense"
)
def
schedule_dense
(
_
,
outs
,
target
):
def
schedule_dense
(
_
,
outs
,
target
):
"""Schedule definition of dense"""
"""Schedule definition of dense"""
...
...
nnvm/src/top/nn/nn.cc
View file @
f1e0a55a
...
@@ -82,21 +82,6 @@ If ``use_bias`` is set to be false, then the ``bias`` term is ignored.
...
@@ -82,21 +82,6 @@ If ``use_bias`` is set to be false, then the ``bias`` term is ignored.
.
set_attr
<
FListInputNames
>
(
"FListInputNames"
,
UseBiasListInputNames
<
DenseParam
>
)
.
set_attr
<
FListInputNames
>
(
"FListInputNames"
,
UseBiasListInputNames
<
DenseParam
>
)
.
set_attr
<
FInferShape
>
(
"FInferShape"
,
DenseInferShape
)
.
set_attr
<
FInferShape
>
(
"FInferShape"
,
DenseInferShape
)
.
set_attr
<
FInferType
>
(
"FInferType"
,
ElemwiseType
<-
1
,
1
>
)
.
set_attr
<
FInferType
>
(
"FInferType"
,
ElemwiseType
<-
1
,
1
>
)
.
set_attr
<
FTVMCompute
>
(
"FTVMCompute"
,
[](
const
NodeAttrs
&
attrs
,
const
Array
<
Tensor
>&
inputs
,
const
Array
<
Tensor
>&
out_info
)
{
Tensor
bias_val
;
Tensor
*
bias
;
const
DenseParam
&
param
=
nnvm
::
get
<
DenseParam
>
(
attrs
.
parsed
);
if
(
param
.
use_bias
)
{
bias_val
=
inputs
[
2
];
bias
=
&
bias_val
;
}
else
{
bias
=
nullptr
;
}
return
Array
<
Tensor
>
{
topi
::
nn
::
dense
(
inputs
[
0
],
inputs
[
1
],
bias
)
};
})
.
set_attr
<
FGradient
>
(
.
set_attr
<
FGradient
>
(
"FGradient"
,
[](
const
NodePtr
&
n
,
"FGradient"
,
[](
const
NodePtr
&
n
,
const
std
::
vector
<
NodeEntry
>&
ograds
)
{
const
std
::
vector
<
NodeEntry
>&
ograds
)
{
...
...
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