SnapML: Model issue with PRelu
Hi! I have an onnx model with PRelu and when I add it to Lens it gives me:
Failed to add resource: The ONNX model's prelu alpha tensor dimension must be 1
However, onnx docs says the following:
If Slope is of size 1, the value is shared across different channels
Pytorch to onnx does right by broadcasting PRelu alpha (slope) for RGB images.
https://github.com/onnx/onnx/blob/master/docs/Changelog.md#prelu-6
Hi Aleksey,
Thanks for your feedback. This is due to current limitation of our internal inference framework. If you intend to broadcast a shared slope across all channels, one alternative is to use Leaky Relu with single alpha. We will also let you know when we have made changes to support PRelu with a shared slope in future releases, thanks!
Eric
Hi Aleksey,
Would you mind sharing your onnx model for us to take a look? We have tested creating dummy models with torch.nn.PReLU(num_parameters=1) and torch.nn.PReLU(num_parameters=num_of_channels), both of them can be imported successfully into Lens Studio.
Eric
Sure. Here it is.
https://drive.google.com/file/d/1KQYJB50O4O_gR3Qi8cZarFTp_tW6WoOM/view?usp=sharing
Hi Aleksey,
Thanks for sharing your model. Looks like the slope of the PReLU layer in your model has dimension 3, which is not supported by our internal framework yet. We are planning to add this support in future releases, thanks!
Eric