Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
qjia7 committed Jan 27, 2024
1 parent d08ddca commit ca10df1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/web/lib/wasm/jsep/webgpu/ops/fuse-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ export const getActivationSnippet = (attributes: InternalActivationAttributes, v
case 'HardSigmoid':
return `value = max(${valueType}(0.0), min(${valueType}(1.0), ${valueType}(uniforms.alpha) * value + ${
valueType}(uniforms.beta)));`;
case '':
return '';
// TODO: adding other activations that can be fused.
default:
return '';
throw new Error(`Unsupported activation ${attributes.activation}`);
}
};

Expand All @@ -54,8 +56,7 @@ export const parseInternalActivationAttributes =
if (activation === 'HardSigmoid') {
const [alpha, beta] = attributes?.activation_params as [number, number] || [0.2, 0.5];
return {activation, alpha, beta};
}
if (activation === 'Clip') {
} else if (activation === 'Clip') {
const [clipMin, clipMax] = attributes?.activation_params as [number, number] || [MIN_CLIP, MAX_CLIP];
return {activation, clipMax, clipMin};
}
Expand Down

0 comments on commit ca10df1

Please sign in to comment.