Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
b1bbebaa
Commit
b1bbebaa
authored
Aug 25, 2018
by
Ilya Matiach
Committed by
Guolin Ke
Aug 25, 2018
Browse files
fix num machines check in distributed case (#1611)
parent
08c82ee6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
src/treelearner/serial_tree_learner.cpp
src/treelearner/serial_tree_learner.cpp
+3
-2
No files found.
src/treelearner/serial_tree_learner.cpp
View file @
b1bbebaa
...
...
@@ -785,6 +785,7 @@ void SerialTreeLearner::RenewTreeOutput(Tree* tree, const ObjectiveFunction* obj
bag_mapper
=
bag_indices
;
}
std
::
vector
<
int
>
n_nozeroworker_perleaf
(
tree
->
num_leaves
(),
1
);
int
num_machines
=
Network
::
num_machines
();
#pragma omp parallel for schedule(static)
for
(
int
i
=
0
;
i
<
tree
->
num_leaves
();
++
i
)
{
const
double
output
=
static_cast
<
double
>
(
tree
->
LeafOutput
(
i
));
...
...
@@ -795,12 +796,12 @@ void SerialTreeLearner::RenewTreeOutput(Tree* tree, const ObjectiveFunction* obj
const
double
new_output
=
obj
->
RenewTreeOutput
(
output
,
prediction
,
index_mapper
,
bag_mapper
,
cnt_leaf_data
);
tree
->
SetLeafOutput
(
i
,
new_output
);
}
else
{
CHECK
(
Network
::
num_machines
()
>
1
);
CHECK
(
num_machines
>
1
);
tree
->
SetLeafOutput
(
i
,
0.0
);
n_nozeroworker_perleaf
[
i
]
=
0
;
}
}
if
(
Network
::
num_machines
()
>
1
)
{
if
(
num_machines
>
1
)
{
std
::
vector
<
double
>
outputs
(
tree
->
num_leaves
());
for
(
int
i
=
0
;
i
<
tree
->
num_leaves
();
++
i
)
{
outputs
[
i
]
=
static_cast
<
double
>
(
tree
->
LeafOutput
(
i
));
...
...
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