File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
python/paddle/fluid/layers Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,8 @@ class HierarchicalSigmoidGradOpKernel : public framework::OpKernel<T> {
234
234
zero (dev_ctx, w_grad, static_cast <T>(0.0 ));
235
235
bit_code->MulGradWeight (pre_out_grad, w_grad, in);
236
236
} else {
237
+ PADDLE_ENFORCE (path != nullptr ,
238
+ " Sparse mode should not be used without custom tree!" );
237
239
framework::Vector<int64_t > real_rows = PathToRows (*path);
238
240
auto * w_grad =
239
241
ctx.Output <framework::SelectedRows>(framework::GradVarName (" W" ));
Original file line number Diff line number Diff line change @@ -5589,12 +5589,21 @@ def hsigmoid(input,
5589
5589
raise ValueError (
5590
5590
"num_classes must not be less than 2 with default tree" )
5591
5591
5592
+ if (not is_custom ) and (is_sparse ):
5593
+ print ("Sparse mode should not be used without custom tree" )
5594
+ is_sparse = False
5595
+
5596
+ if (not is_custom ) and ((path_table is not None ) or
5597
+ (path_code is not None )):
5598
+ raise ValueError (
5599
+ "only num_classes should be passed without custom tree" )
5600
+
5592
5601
if (is_custom ) and (path_code is None ):
5593
- raise ValueError ("path_code should not be None with costum tree" )
5602
+ raise ValueError ("path_code should not be None with custom tree" )
5594
5603
elif (is_custom ) and (path_table is None ):
5595
- raise ValueError ("path_table should not be None with costum tree" )
5604
+ raise ValueError ("path_table should not be None with custom tree" )
5596
5605
elif (is_custom ) and (num_classes is None ):
5597
- raise ValueError ("num_classes should not be None with costum tree" )
5606
+ raise ValueError ("num_classes should not be None with custom tree" )
5598
5607
else :
5599
5608
pass
5600
5609
You can’t perform that action at this time.
0 commit comments