deephealthproject / eddl

European Distributed Deep Learning (EDDL) library. A general-purpose library initially developed to cover deep learning needs in healthcare use cases within the DeepHealth project.
https://deephealthproject.github.io/eddl/
MIT License
34 stars 10 forks source link

[Feature Request] Shape ONNX operator #296

Closed MicheleCancilla closed 3 years ago

MicheleCancilla commented 3 years ago

I sometimes got the error Error: The ONNX node type Shape is not supported! while importing ONNX (for example, family models like in #295). The PyTorch code that generates this ONNX layer is:

def forward(self, x):
    size = x.shape[-2:]
    ...
    return F.interpolate(x, size=size, mode='bilinear', align_corners=False)

Do you plan to add support for this operator?

chavicoski commented 3 years ago

We weren't planning to implement that layer since normally when simplifying the models this layer disappears because the output is usually constant. In the case of the model in #295, it has a dynamic input "batch_sizex3x224x224". Because of that when you simplify the model the Shape nodes are not simplified. If you simplify the model adding the flag "--input-shape 64,3,224,224" to set the batch size to any value, the Shape nodes will be simplified. And in the case of the EDDL, after importing, you can set the batch size that you want.

chavicoski commented 3 years ago

I am going to close the issue. In case you have any problem with this, don't hesitate to reopen it. Thanks!