candle
candle copied to clipboard
How to get raw tensor data?
I am trying to implement an adaptive avg pool in candle. However, I guess my implementation will require an API to get the raw data/storage (storaged in plain/flatten array format). Wondering if there is such an API for that?
Thanks!
Yes! The Candle CustomOp API allows this: https://docs.rs/candle-core/latest/candle_core/trait.CustomOp1.html
On the CPU, the storage is: https://docs.rs/candle-core/latest/candle_core/cpu_backend/enum.CpuStorage.html
Thanks for the quick response! I did an initial implementation on CPU backend https://github.com/huggingface/candle/pull/2296 Let me know if this looks good and I can extend this to other backends.