Dummy_input for numpy_module

I am trying to run the example in the article “Quantization of Neural Networks for Fully Homomorphic Encryption” under the heading “FHE-friendly Neural Network”.

I was able to run the code up to line 52 (numpy_fc_model = NumpyModule(torch_fc_model)).
But then I get the error “dummy_input must be provided if model is a torch.nn.Module”.

I don’t know what kind of data I can use to run the code.

Indeed, the code in the blog was made with a previous version. I have updated the gist so that the code should now work properly.

Here is how you can create the dummy input which is only used to trace the torch forward function (we now support any custom architecture so a CNN should work fine if you want to try.)

# Create some dummy input for the tracing
dummy_data = torch.randn(1, n_features)

# Carry torch model to numpy (required in by concrete)
numpy_fc_model = NumpyModule(torch_fc_model, dummy_data)