webonnx / wonnx

A WebGPU-accelerated ONNX inference run-time written 100% in Rust, ready for native and the web
Other
1.54k stars 54 forks source link

Erf operator Implementation #199

Closed AmineDiro closed 1 month ago

AmineDiro commented 6 months ago

Hello,

This is implementation on the approximate Erf operator. This operator is needed for models using the GELU activation function for example the majority of transformer models.

Onnx supports Gelu directly but it is starting from opset 20 so I think that this operator is useful for now.

Happy to make changes based on your suggestions !

pixelspark commented 6 months ago

Hi @AmineDiro! Sorry, only just got around to having a look at this. Your PR looks good! I would suggest however placing the Erf calculation itself in the activation templates (here) - otherwise we will end up with many different templates for similar functions.

AmineDiro commented 6 months ago

Hi @pixelspark , No worries, thanks for taking the time to review this PR! I didn't know where to put the function I'll do the necessary modification and push it! Thanks again and happy new year 🎉

sluramod commented 1 month ago

@pixelspark could you please merge this PR?

pixelspark commented 1 month ago

Sorry, took a while, thanks for the contribution!