Unity-Technologies / barracuda-release

Other
567 stars 77 forks source link

Problem about the support to torch.nn.GroupNormal #273

Closed CLiMalik closed 2 years ago

CLiMalik commented 2 years ago

Hi all,

Recently, I have exported a torch.nn.GroupNormalization layer to a onnx file. As a result, this file includes Aten type. An error occured when I tried to import this onnx file into a Unity project. The error is posted below:

OnnxImportException: Unknown type ATen encountered while parsing layer 27. Asset import failed, "Assets/NN/example.onnx" > OnnxImportException: Unknown type ATen encountered while parsing layer 27.

Is there any possible method to import a neural network including GroupNormalization layer into unity projects?

Thanks. Chen

CLiMalik commented 2 years ago

The previous problem seems to be fixed. I just updated my PyTorch to 1.11.0 and the torch.nn.GroupNorm was supported by an op in onnx called InstanceNormalization. However, another problem occurs when I imported the new model into Unity.

image

You can find the model here: https://drive.google.com/file/d/10rSZHetlZ6arR2AezX2JVu0bL7Emgn1n/view?usp=sharing

Aurimasp commented 2 years ago

Hi CLiMalik, do the outputs differ between PyTorch and Barracuda? Barracuda points out these shapes as unusual, but if it returns expected outputs, then you can ignore these warnings. I will close this issue but feel free to reopen it if model outputs do not match.

EmileGr commented 2 years ago

@Aurimasp Those warnings aren't necessarily harmless. In my case I have a model that was converted from Pytorch that also uses torch.nn.GroupNormal and it throws errors when trying to use it during runtime. The runtime error seems to correlate with the warnings. image - Copy image - Copy (2)

Aurimasp commented 2 years ago

Hi @EmileGr , would it be possible to share this model with us?