Closed vieting closed 3 years ago
Many issues where you should use nest instead.
Thanks for the hint, I'll check that and update accordingly.
But more general: I don't understand, why does the model_func need this? The model_func is just intended as a simple wrapper to test the conversion. For nothing more. You don't really need this. Or why do you need this?
E.g. the module in here has a dict as input. In order to convert it, I create a model_func in which I load the module and forward the inputs to the model_function through the module. Therefore I need the dict as input. Or do you have an easier way?
E.g. the module in here has a dict as input. In order to convert it, I create a model_func in which I load the module and forward the inputs to the model_function through the module. Therefore I need the dict as input. Or do you have an easier way?
The model_func
is just for testing. It is not meant to wrap a module. It just needs the numpy array for the test, nothing else.
See this example. It even loads a custom dict from a config file and passes it to the module. But the model_func
function just gets the numpy array, nothing else.
Yes, I think you're right. This is probably not necessary.
This PR makes it possible to use dicts or lists of tensors as input to the PyTorch models that should be converted. It was already possible to have them as input/output of a forward function (see the new
test_dict_in_forward
which already passes without the suggested modifications). Now, it is also possible to have them as the initial input to the model.