Skip to content

Commit 96198a4

Browse files
authored
Merge pull request #706 from huningxin/conv2d_missing_validation
Bugfix: Add missing validation for conv2d() and convTranspose2d()
2 parents ec64348 + 68cefc7 commit 96198a4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

index.bs

+3
Original file line numberDiff line numberDiff line change
@@ -1851,6 +1851,7 @@ partial interface MLGraphBuilder {
18511851
1. If any element in |options|.{{MLConv2dOptions/strides}} is equal to 0, then [=exception/throw=] a {{TypeError}}.
18521852
1. If |options|.{{MLConv2dOptions/dilations}} does not [=map/exist=], set it to the [=/list=] « 1, 1 ».
18531853
1. Otherwise, if |options|.{{MLConv2dOptions/dilations}}'s [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}.
1854+
1. If any element in |options|.{{MLConv2dOptions/dilations}} is equal to 0, then [=exception/throw=] a {{TypeError}}.
18541855
1. If |options|.{{MLConv2dOptions/groups}} is 0, then [=exception/throw=] a {{TypeError}}.
18551856
1. *Calculate the output shape:*
18561857
1. Let |inputShape| be |input|'s [=MLOperand/shape=].
@@ -2060,12 +2061,14 @@ partial interface MLGraphBuilder {
20602061
1. If any element in |options|.{{MLConv2dOptions/strides}} is equal to 0, then [=exception/throw=] a {{TypeError}}.
20612062
1. If |options|.{{MLConvTranspose2dOptions/dilations}} does not [=map/exist=], set it to the [=/list=] « 1, 1 ».
20622063
1. Otherwise, if |options|.{{MLConvTranspose2dOptions/dilations}}'s [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}.
2064+
1. If any element in |options|.{{MLConvTranspose2dOptions/dilations}} is equal to 0, then [=exception/throw=] a {{TypeError}}.
20632065
1. If |options|.{{MLConvTranspose2dOptions/outputPadding}} does not [=map/exist=], set it to the [=/list=] « 0, 0 ».
20642066
1. Otherwise, if |options|.{{MLConvTranspose2dOptions/outputPadding}}'s [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}.
20652067
1. If |options|.{{MLConvTranspose2dOptions/outputSizes}} [=map/exists=]:
20662068
1. If its [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}.
20672069
1. Otherwise:
20682070
1. If |options|.{{MLConvTranspose2dOptions/outputPadding}}[0] is greater than or equal to |options|.{{MLConvTranspose2dOptions/strides}}[0], or |options|.{{MLConvTranspose2dOptions/outputPadding}}[1] is greater than or equal to |options|.{{MLConvTranspose2dOptions/strides}}[1], then [=exception/throw=] a {{TypeError}}.
2071+
1. If |options|.{{MLConvTranspose2dOptions/groups}} is 0, then [=exception/throw=] a {{TypeError}}.
20692072
1. *Calculate the output shape:*
20702073
1. Let |inputShape| be |input|'s [=MLOperand/shape=].
20712074
1. Switch on |options|.{{MLConvTranspose2dOptions/inputLayout}}:

0 commit comments

Comments
 (0)