-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[js/web] adding conv fuse logic (#7604)
* adding conv fuse logic * fixing merge * fix file name in kebab case * fix lint error
- Loading branch information
Showing
7 changed files
with
91 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
import {glslRelu, glslSigmoid} from './unary-op'; | ||
|
||
export function getActicationSnippet(activation: string) { | ||
let activationFunction = ''; | ||
let activationName = ''; | ||
switch (activation) { | ||
case 'Relu': | ||
activationName = glslRelu().name; | ||
activationFunction = glslRelu().body; | ||
break; | ||
case 'Sigmoid': | ||
activationName = glslSigmoid().name; | ||
activationFunction = glslSigmoid().body; | ||
break; | ||
default: | ||
// TODO: adding other activations that can be fused. | ||
activationName = ''; | ||
activationFunction = ''; | ||
} | ||
const applyActivation = activation ? ` | ||
value = ${activationName}(value);` : | ||
''; | ||
return {activationFunction, applyActivation}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters