M3d-Cam icon indicating copy to clipboard operation
M3d-Cam copied to clipboard

Multiple inputs to model producing TypeError

Open aritche opened this issue 1 year ago • 2 comments

Hi,

My model has multiple inputs, i.e. the forward method of the model has two arguments: fmri_input, anat_input. When I try to wrap the model with model = medcam.inject(model, ...etc), and do forward propagation with: model(fmri_input, anat_input), the script returns the error: "TypeError: forward() missing 1 required positional argument: 'anat_input'".

Is it possible to use medcam on a model that takes multiple inputs?

Thanks!

aritche avatar Mar 07 '23 22:03 aritche

Hi, you can adapt the trick mentioned here to work with either multiple inputs, outputs or both.

burhr2 avatar Oct 10 '23 11:10 burhr2

Hi,

My model has multiple inputs, i.e. the forward method of the model has two arguments: fmri_input, anat_input. When I try to wrap the model with model = medcam.inject(model, ...etc), and do forward propagation with: model(fmri_input, anat_input), the script returns the error: "TypeError: forward() missing 1 required positional argument: 'anat_input'".

Is it possible to use medcam on a model that takes multiple inputs?

Thanks!

Have you implemented it? I've encountered the same issue.

yuanpengpeng avatar Feb 19 '24 09:02 yuanpengpeng