Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

WebGL: Fix potential compilation failure in LeakyRelu op #106

Merged
merged 2 commits into from
Mar 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/backends/webgl/ops/leaky-relu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class WebGLLeakyRelu extends LeakyRelu implements WebGLOperator {
uniform sampler2D A;
void main() {
float v = texture2D(A, TexCoords).r;
gl_FragColor = vec4(v < 0.0 ? v * ${this.alpha} : v);
gl_FragColor = vec4(v < 0.0 ? v * float(${this.alpha}) : v);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is float() works in compile time or runtime in glsl? if it is the latter then toExponential() is a better option

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can tackle this solution across all the shaders (many shaders need the answer to that investigation)

}
`;
return {
Expand Down