A reconfigurable silicon quantum photonic device for machine learning applications