Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change type of label tensor to int32/int64 in SoftmaxCrossEntropyLoss spec. #2667

Merged
merged 1 commit into from Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/Changelog.md
Expand Up @@ -14965,7 +14965,7 @@ This version of the operator has been available since version 12 of the default
<dl>
<dt><tt>scores</tt> : T</dt>
<dd>The predicted outputs with shape [batch_size, class_size], or [batch_size, class_size, D1, D2 , ..., Dk], where K is the number of dimensions.</dd>
<dt><tt>labels</tt> : T</dt>
<dt><tt>labels</tt> : Tind</dt>
<dd>The ground truth output tensor, with shape [batch_size], or [batch_size, D1, D2, ..., Dk], where K is the number of dimensions.</dd>
<dt><tt>weights</tt> (optional) : T</dt>
<dd>A manual rescaling weight given to each class. If given, it has to be a 1D Tensor assigning weight to each of the classes. Otherwise, it is treated as if having all ones.</dd>
Expand All @@ -14985,6 +14985,8 @@ This version of the operator has been available since version 12 of the default
<dl>
<dt><tt>T</tt> : tensor(float16), tensor(float), tensor(double)</dt>
<dd>Constrain input and output types to float tensors.</dd>
<dt><tt>Tind</tt> : tensor(int32), tensor(int64)</dt>
<dd>Constrain target to integer types</dd>
</dl>

### <a name="UnfoldToDepth-12"></a>**UnfoldToDepth-12**</a>
Expand Down
4 changes: 3 additions & 1 deletion docs/Operators.md
Expand Up @@ -18218,7 +18218,7 @@ This version of the operator has been available since version 12 of the default
<dl>
<dt><tt>scores</tt> : T</dt>
<dd>The predicted outputs with shape [batch_size, class_size], or [batch_size, class_size, D1, D2 , ..., Dk], where K is the number of dimensions.</dd>
<dt><tt>labels</tt> : T</dt>
<dt><tt>labels</tt> : Tind</dt>
<dd>The ground truth output tensor, with shape [batch_size], or [batch_size, D1, D2, ..., Dk], where K is the number of dimensions.</dd>
<dt><tt>weights</tt> (optional) : T</dt>
<dd>A manual rescaling weight given to each class. If given, it has to be a 1D Tensor assigning weight to each of the classes. Otherwise, it is treated as if having all ones.</dd>
Expand All @@ -18238,6 +18238,8 @@ This version of the operator has been available since version 12 of the default
<dl>
<dt><tt>T</tt> : tensor(float16), tensor(float), tensor(double)</dt>
<dd>Constrain input and output types to float tensors.</dd>
<dt><tt>Tind</tt> : tensor(int32), tensor(int64)</dt>
<dd>Constrain target to integer types</dd>
</dl>


Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Expand Up @@ -9,7 +9,7 @@
Z
y



b
z

Expand Down
Binary file not shown.
Expand Up @@ -23,7 +23,7 @@ QSoftmaxCrossEntropyLoss_test_softmax_cross_entropy_none_expanded_functionlog_pr
Z
y



b
z

Expand Down
Binary file not shown.
Expand Up @@ -10,7 +10,7 @@
Z
y



Z
w

Expand Down
Binary file not shown.
Expand Up @@ -25,7 +25,7 @@ YSoftmaxCrossEntropyLoss_test_softmax_cross_entropy_none_weights_expanded_functi
Z
y



Z
w

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 5 additions & 1 deletion onnx/defs/math/defs.cc
Expand Up @@ -2340,7 +2340,7 @@ ONNX_OPERATOR_SET_SCHEMA(
"labels",
"The ground truth output tensor, with shape [batch_size], or "
"[batch_size, D1, D2, ..., Dk], where K is the number of dimensions.",
"T")
"Tind")
.Input(
2,
"weights",
Expand All @@ -2366,6 +2366,10 @@ ONNX_OPERATOR_SET_SCHEMA(
"T",
{"tensor(float16)", "tensor(float)", "tensor(double)"},
"Constrain input and output types to float tensors.")
.TypeConstraint(
"Tind",
{"tensor(int32)", "tensor(int64)"},
"Constrain target to integer types")
.SetContextDependentFunctionBodyBuilder(BuildContextDependentFunctionBodySCE)
.TypeAndShapeInferenceFunction([](InferenceContext& ctx) {
propagateElemTypeFromInputToOutput(ctx, 0, 0);
Expand Down