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

Increase SequenceMap version to 17 #4133

Merged
merged 4 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
91 changes: 46 additions & 45 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20771,7 +20771,51 @@ This version of the operator has been available since version 16 of the default
<dd>Constrain input and output types to any tensor type.</dd>
</dl>

### <a name="SequenceMap-16"></a>**SequenceMap-16**</a>
### <a name="Where-16"></a>**Where-16**</a>

Return elements, either from X or Y, depending on condition.
Where behaves like
[numpy.where](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html)
with three parameters.

This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md).

**History**
- Version 16 adds bfloat16 to the types allowed (for the second and third parameter).

#### Version

This version of the operator has been available since version 16 of the default ONNX operator set.

#### Inputs

<dl>
<dt><tt>condition</tt> (non-differentiable) : B</dt>
<dd>When True (nonzero), yield X, otherwise yield Y</dd>
<dt><tt>X</tt> (differentiable) : T</dt>
<dd>values selected at indices where condition is True</dd>
<dt><tt>Y</tt> (differentiable) : T</dt>
<dd>values selected at indices where condition is False</dd>
</dl>

#### Outputs

<dl>
<dt><tt>output</tt> (differentiable) : T</dt>
<dd>Tensor of shape equal to the broadcasted shape of condition, X, and Y.</dd>
</dl>

#### Type Constraints

<dl>
<dt><tt>B</tt> : tensor(bool)</dt>
<dd>Constrain to boolean tensors.</dd>
<dt><tt>T</tt> : tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(bfloat16), tensor(float16), tensor(float), tensor(double), tensor(string), tensor(bool), tensor(complex64), tensor(complex128)</dt>
<dd>Constrain input and output types to all tensor types (including bfloat).</dd>
</dl>

## Version 17 of the default ONNX operator set
### <a name="SequenceMap-17"></a>**SequenceMap-17**</a>

Applies a sub-graph to each sample in the input sequence(s).

Expand All @@ -20790,7 +20834,7 @@ This version of the operator has been available since version 16 of the default

#### Version

This version of the operator has been available since version 16 of the default ONNX operator set.
This version of the operator has been available since version 17 of the default ONNX operator set.

#### Attributes

Expand Down Expand Up @@ -20824,49 +20868,6 @@ This version of the operator has been available since version 16 of the default
<dd>Constrain to any tensor or sequence type.</dd>
</dl>

### <a name="Where-16"></a>**Where-16**</a>

Return elements, either from X or Y, depending on condition.
Where behaves like
[numpy.where](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html)
with three parameters.

This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md).

**History**
- Version 16 adds bfloat16 to the types allowed (for the second and third parameter).

#### Version

This version of the operator has been available since version 16 of the default ONNX operator set.

#### Inputs

<dl>
<dt><tt>condition</tt> (non-differentiable) : B</dt>
<dd>When True (nonzero), yield X, otherwise yield Y</dd>
<dt><tt>X</tt> (differentiable) : T</dt>
<dd>values selected at indices where condition is True</dd>
<dt><tt>Y</tt> (differentiable) : T</dt>
<dd>values selected at indices where condition is False</dd>
</dl>

#### Outputs

<dl>
<dt><tt>output</tt> (differentiable) : T</dt>
<dd>Tensor of shape equal to the broadcasted shape of condition, X, and Y.</dd>
</dl>

#### Type Constraints

<dl>
<dt><tt>B</tt> : tensor(bool)</dt>
<dd>Constrain to boolean tensors.</dd>
<dt><tt>T</tt> : tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(bfloat16), tensor(float16), tensor(float), tensor(double), tensor(string), tensor(bool), tensor(complex64), tensor(complex128)</dt>
<dd>Constrain input and output types to all tensor types (including bfloat).</dd>
</dl>

# ai.onnx.preview.training
## Version 1 of the 'ai.onnx.preview.training' operator set
### <a name="ai.onnx.preview.training.Adagrad-1"></a>**ai.onnx.preview.training.Adagrad-1**</a>
Expand Down
4 changes: 2 additions & 2 deletions docs/Operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ For an operator input/output's differentiability, it can be differentiable,
|<a href="#MeanVarianceNormalization">MeanVarianceNormalization</a>|<a href="Changelog.md#MeanVarianceNormalization-13">13</a>, <a href="Changelog.md#MeanVarianceNormalization-9">9</a>|
|<a href="#NegativeLogLikelihoodLoss">NegativeLogLikelihoodLoss</a>|<a href="Changelog.md#NegativeLogLikelihoodLoss-13">13</a>, <a href="Changelog.md#NegativeLogLikelihoodLoss-12">12</a>|
|<a href="#Range">Range</a>|<a href="Changelog.md#Range-11">11</a>|
|<a href="#SequenceMap">SequenceMap</a>|<a href="Changelog.md#SequenceMap-16">16</a>|
|<a href="#SequenceMap">SequenceMap</a>|<a href="Changelog.md#SequenceMap-17">17</a>|
|<a href="#Softmax">Softmax</a>|<a href="Changelog.md#Softmax-13">13</a>, <a href="Changelog.md#Softmax-11">11</a>, <a href="Changelog.md#Softmax-1">1</a>|
|<a href="#SoftmaxCrossEntropyLoss">SoftmaxCrossEntropyLoss</a>|<a href="Changelog.md#SoftmaxCrossEntropyLoss-13">13</a>, <a href="Changelog.md#SoftmaxCrossEntropyLoss-12">12</a>|

Expand Down Expand Up @@ -19694,7 +19694,7 @@ This version of the operator has been available since version 11 of the default

#### Version

This version of the operator has been available since version 16 of the default ONNX operator set.
This version of the operator has been available since version 17 of the default ONNX operator set.

#### Attributes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
y0"


NB
NB
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
y0"


NB
NB
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@



B
B
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ n
y"


NB
NB
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
y1"


MB
MB
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
y1"


MB
MB
Binary file not shown.
15 changes: 13 additions & 2 deletions onnx/defs/operator_sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,6 @@ class ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 16, LessOrEqual);
class ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 16, GreaterOrEqual);
class ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 16, LeakyRelu);
class ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 16, PRelu);
class ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 16, SequenceMap);

// Iterate over schema from ai.onnx version 16
class OpSet_Onnx_ver16 {
Expand All @@ -1024,9 +1023,20 @@ class OpSet_Onnx_ver16 {
fn(GetOpSchema<ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 16, GreaterOrEqual)>());
fn(GetOpSchema<ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 16, LeakyRelu)>());
fn(GetOpSchema<ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 16, PRelu)>());
fn(GetOpSchema<ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 16, SequenceMap)>());
}
};

jcwchen marked this conversation as resolved.
Show resolved Hide resolved
// Forward declarations for ai.onnx version 17
class ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 17, SequenceMap);

// Iterate over schema from ai.onnx version 17
class OpSet_Onnx_ver17 {
public:
static void ForEachSchema(std::function<void(OpSchema&&)> fn) {
fn(GetOpSchema<ONNX_OPERATOR_SET_SCHEMA_CLASS_NAME(Onnx, 17, SequenceMap)>());
}
};

inline void RegisterOnnxOperatorSetSchema() {
RegisterOpSetSchema<OpSet_Onnx_ver1>();
RegisterOpSetSchema<OpSet_Onnx_ver2>();
Expand All @@ -1044,6 +1054,7 @@ inline void RegisterOnnxOperatorSetSchema() {
RegisterOpSetSchema<OpSet_Onnx_ver14>();
RegisterOpSetSchema<OpSet_Onnx_ver15>();
RegisterOpSetSchema<OpSet_Onnx_ver16>();
RegisterOpSetSchema<OpSet_Onnx_ver17>();
// 0 means all versions of ONNX schema have been loaded
OpSchemaRegistry::Instance()->SetLoadedSchemaVersion(0);
}
Expand Down
4 changes: 2 additions & 2 deletions onnx/defs/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ class OpSchema final {

bool has_data_propagation_function() const {
return data_propagation_function_ ? true : false;
}
}

bool HasFunction() const {
return function_body_.node_size() > 0;
Expand Down Expand Up @@ -994,7 +994,7 @@ class OpSchemaRegistry final : public ISchemaRegistry {
// Increase the highest version when you make BC-breaking changes to the
// operator schema on specific domain. Update the lowest version when it's
// determined to remove too old version history.
map_[ONNX_DOMAIN] = std::make_pair(1, 16);
map_[ONNX_DOMAIN] = std::make_pair(1, 17);
map_[AI_ONNX_ML_DOMAIN] = std::make_pair(1, 3);
map_[AI_ONNX_TRAINING_DOMAIN] = std::make_pair(1, 1);
// ONNX's preview domain contains operators subject to change, so
Expand Down
6 changes: 3 additions & 3 deletions onnx/defs/sequence/defs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ ONNX_OPERATOR_SET_SCHEMA(
}
}));

static const char* SequenceMap_ver16_doc = R"DOC(
static const char* SequenceMap_ver17_doc = R"DOC(
Applies a sub-graph to each sample in the input sequence(s).

Inputs can be either tensors or sequences, with the exception of the first input which must
Expand Down Expand Up @@ -903,9 +903,9 @@ bool BuildSequenceMapBodyFunc(const FunctionBodyBuildContext& ctx,

ONNX_OPERATOR_SET_SCHEMA(
SequenceMap,
16,
17,
OpSchema()
.SetDoc(SequenceMap_ver16_doc)
.SetDoc(SequenceMap_ver17_doc)
.Attr(
"body",
"The graph to be run for each sample in the sequence(s). "
Expand Down