Skip to content

Commit

Permalink
fix: #155 sign(..) workaround on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelspark committed Apr 22, 2023
1 parent 62533bd commit 61e2c0e
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions wonnx/templates/endomorphism/map.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,6 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
let boundary = one * {{ scalar_type }}(10);
let intermediate = max(-boundary, min(boundary, input_0.data[gidx]));
output_0.data[gidx] = tanh(intermediate);
{% elif op_type == "Sign" %}
{# sign(input_0.data[gidx]) should work but for some reason fails on Windows. Therefore we implement it here the slow way... #}
{% for i in range(end = 4) %}
if input_0.data[gidx][{{i}}] < {{ scalar_type }}(0) {
output_0.data[gidx][{{i}}] = {{ scalar_type }}(-1);
}
else if input_0.data[gidx][{{i}}] > {{ scalar_type }}(0) {
output_0.data[gidx][{{i}}] = {{ scalar_type }}(1);
}
else {
output_0.data[gidx][{{i}}] = {{ scalar_type }}(0);
}
{% endfor %}
{% else %}
output_0.data[gidx] = {{ op_type | lower }}(input_0.data[gidx]);

Expand Down

0 comments on commit 61e2c0e

Please sign in to comment.