oneapi-src / oneDNN

oneAPI Deep Neural Network Library (oneDNN)
https://uxlfoundation.org
Apache License 2.0
3.59k stars 989 forks source link

Some unimplemented unary expressions? #1697

Open WilliamTambellini opened 1 year ago

WilliamTambellini commented 1 year ago

Hi Here are some unary ops currently not implemented in 1dnn (or I missed them):

https://en.wikipedia.org/wiki/File:Gjl-t(x).svg

Best

vpirogov commented 1 year ago

@WilliamTambellini,

Isn't reciprocal square root supported by eltwise pow algorithm with alpha =1 and beta = -1/2?

Will adding sin/cos algorithms to eltwise primitive be enough to cover embeddings case?

WilliamTambellini commented 1 year ago

Thanks

lucasalavapena commented 1 year ago

+1 for adding cos/sin elementwise! I would also greatly appreciate it!

igorsafo commented 1 year ago

@WilliamTambellini @lucasalavapena Thank you for the request, regarding sin/cos: ML frameworks have their own implementation and C++ applications have access to the standard math library with cos/sin functions, so what is the benefit of having an additional implementation under oneDNN API?

@WilliamTambellini I see that positional encoding does not depend on the actual data, is it pre-computed prior to inference/training and remains constant during the process?

lucasalavapena commented 1 year ago

@igorsafo I am still relatively new to oneDNN, so hopefully what I am saying makes sense :smile: .

I was more thinking of having it as an op for dnnl::graph, so you can get some benefits you normally can get with the graph extension (memory layout and use of graph compiler?).

Aren't some of the existing element wise functions part of the standard math library too?