Export onnx on matlab from pytorch model


I am trying to export a torchvision.model.

the model is r3d-18 (resnet3D)

import torch
import torch.onnx
import torchvision

dummy_input = torch.randn(1, 3, 4, 112, 112)
model = torchvision.models.video.r3d_18(pretrained=True)
torch.onnx.export(model, x, "ResNet3D-18.onnx")

I tried to load the onnx file on matlab.

but matlab say ‘mismatch size error, It is different with expected size’.

I found the input shape at https://github.com/pytorch/pytorch/pull/30121/files

You are passing x to torch.onnx.export, while it seems dummy_input should have been passed.
Could you check it or is it a copy-paste error?