Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pate test specify type #3348

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

gmuraru
Copy link
Member

@gmuraru gmuraru commented Apr 13, 2020

Tested Pysyft with torch nightly and found this problem.
The PR can be checked out here.
The problem I had is:

  def test_torch_ref_match():
    
        # Verify if the torch implementation values match the original Numpy implementation.
    
        num_teachers, num_examples, num_labels = (100, 50, 10)
        preds = (np.random.rand(num_teachers, num_examples) * num_labels).astype(int)  # fake preds
    
        indices = (np.random.rand(num_examples) * num_labels).astype(int)  # true answers
    
        preds[:, 0:10] *= 0
    
        data_dep_eps, data_ind_eps = pate.perform_analysis_torch(
            preds, indices, noise_eps=0.1, delta=1e-5
        )
    
        data_dep_eps_ref, data_ind_eps_ref = pate.perform_analysis(
            preds, indices, noise_eps=0.1, delta=1e-5
        )
    
>       assert torch.isclose(data_dep_eps, torch.tensor(data_dep_eps_ref))
E       RuntimeError: Float did not match Double

@gmuraru gmuraru force-pushed the gm-explicitally-specify-type branch from ef68a9f to a9ec9f9 Compare April 13, 2020 07:47
@gmuraru gmuraru changed the title Pate test, explicitally speciy type Pate test specify type Apr 13, 2020
@gmuraru gmuraru requested a review from LaRiffle April 13, 2020 12:41
@karlhigley karlhigley merged commit 53fc017 into OpenMined:master Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants