From 61e2c0e4fad0e11346bad79a96a574a321dd51b8 Mon Sep 17 00:00:00 2001 From: Tommy van der Vorst Date: Sat, 22 Apr 2023 15:24:22 +0200 Subject: [PATCH] fix: #155 sign(..) workaround on Windows --- wonnx/templates/endomorphism/map.wgsl | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/wonnx/templates/endomorphism/map.wgsl b/wonnx/templates/endomorphism/map.wgsl index 727ba546..01356f25 100644 --- a/wonnx/templates/endomorphism/map.wgsl +++ b/wonnx/templates/endomorphism/map.wgsl @@ -25,19 +25,6 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { 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]);