提交 e423c5d0 编写于 作者: Y Yu Yang

It is no need to config num_classes in hsigmoid

It should be always equals to label's size.
上级 d324ed7f
......@@ -1916,7 +1916,7 @@ def cos_sim(a, b, scale=1, size=1, name=None, layer_attr=None):
@layer_support()
def hsigmoid(input,
label,
num_classes,
num_classes=None,
name=None,
bias_attr=None,
param_attr=None,
......@@ -1932,8 +1932,7 @@ def hsigmoid(input,
.. code-block:: python
cost = hsigmoid(input=[layer1, layer2],
label=data_layer,
num_classes=3)
label=data_layer)
:param input: Input layers. It could be a LayerOutput or list/tuple of
LayerOutput.
......@@ -1941,12 +1940,14 @@ def hsigmoid(input,
:param label: Label layer.
:type label: LayerOutput
:param num_classes: number of classes.
:type num_classes: int
:type num_classes: int|None
:param name: layer name
:type name: basestring
:param bias_attr: Bias attribute. None means default bias.
False means no bias.
:type bias_attr: ParameterAttribute|False
:param param_attr: Parameter Attribute. None means default parameter.
:type param_attr: ParameterAttribute|None
:param layer_attr: Extra Layer Attribute.
:type layer_attr: ExtraLayerAttribute
:return: LayerOutput object.
......@@ -1966,6 +1967,11 @@ def hsigmoid(input,
assert isinstance(label, LayerOutput)
assert label.layer_type == LayerType.DATA
if num_classes is None:
num_classes = label.size
if num_classes is None or num_classes <= 2:
raise ValueError("hsigmoid label size must larger than 2.")
ipts_for_layer = []
parents = []
for each_input, each_param_attr in zip(input, param_attr):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册