Skip to content

Commit d3ccbc2

Browse files
committed
[js/webgpu] Fix activation_params in FusedConv
Bug: #18899
1 parent ffa6602 commit d3ccbc2

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

Diff for: js/web/test/data/ops/fused-conv.jsonc

+68
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,73 @@
108108
]
109109
}
110110
]
111+
},
112+
{
113+
"name": "fused conv with clip",
114+
"operator": "FusedConv",
115+
"attributes": [
116+
{ "name": "activation", "data": "Clip", "type": "string" },
117+
{ "name": "kernel_shape", "data": [2, 2], "type": "ints" },
118+
{ "name": "activation_params", "data": [0.0, 600.0], "type": "floats" }
119+
],
120+
"opset": { "domain": "com.microsoft", "version": 1 },
121+
"cases": [
122+
{
123+
"name": "T[0]",
124+
"inputs": [
125+
{
126+
"data": [10, 20, 30, 40, 50, 60, 70, 80, 90],
127+
"dims": [1, 1, 3, 3],
128+
"type": "float32"
129+
},
130+
{
131+
"data": [1, 2, 3, 4],
132+
"dims": [1, 1, 2, 2],
133+
"type": "float32"
134+
}
135+
],
136+
"outputs": [
137+
{
138+
"data": [370, 470, 600, 600],
139+
"dims": [1, 1, 2, 2],
140+
"type": "float32"
141+
}
142+
]
143+
}
144+
]
145+
},
146+
{
147+
"name": "fused conv with clip",
148+
"operator": "FusedConv",
149+
"attributes": [
150+
{ "name": "activation", "data": "Clip", "type": "string" },
151+
{ "name": "kernel_shape", "data": [2, 2], "type": "ints" },
152+
{ "name": "activation_params", "data": [0.0, 400.0], "type": "floats" }
153+
],
154+
"opset": { "domain": "com.microsoft", "version": 1 },
155+
"cases": [
156+
{
157+
"name": "T[0]",
158+
"inputs": [
159+
{
160+
"data": [10, 20, 30, 40, 50, 60, 70, 80, 90],
161+
"dims": [1, 1, 3, 3],
162+
"type": "float32"
163+
},
164+
{
165+
"data": [1, 2, 3, 4],
166+
"dims": [1, 1, 2, 2],
167+
"type": "float32"
168+
}
169+
],
170+
"outputs": [
171+
{
172+
"data": [370, 400, 400, 400],
173+
"dims": [1, 1, 2, 2],
174+
"type": "float32"
175+
}
176+
]
177+
}
178+
]
111179
}
112180
]

Diff for: onnxruntime/core/providers/js/operators/conv.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class ConvBase : public JsKernel {
3030
}
3131
if (is_fused_conv) {
3232
ORT_THROW_IF_ERROR(info.GetAttr<std::string>("activation", &conv_attrs_.activation));
33-
ORT_THROW_IF_ERROR(info.GetAttrs<float>("activation_params", activation_params));
33+
if (conv_attrs_.activation == "Clip") {
34+
ORT_THROW_IF_ERROR(info.GetAttrs<float>("activation_params", activation_params));
35+
}
3436
} else {
3537
conv_attrs_.activation = info.GetAttrOrDefault<std::string>("activation", "");
3638
activation_params = info.GetAttrsOrDefault<float>("activation_params", activation_params);

0 commit comments

Comments
 (0)