fa6f47e7aee228226421c52e61cce4e1ab4cc099,tests/ml/test_loss.py,,test_permutation_invariant_loss_tf,#,40
Before Change
shifted_sources = torch.cat(
[sources_a, sources_b], dim=-1)
_loss_b = LossPIT(shifted_sources, sources).item()
assert _loss_a == _loss_b
def test_combination_invariant_loss_tf():
n_batch = 40
n_time = 400
After Change
noise_amount = [0.001, .01, .05, 1.0]
for n in noise_amount:
permuted = []
noisy = sources + n * torch.randn_like(sources)
_loss_a = LossL1(noisy, sources).item()
for i in range(n_batch):
p = random.choice(list(permutations(range(n_sources))))
permuted_batch = noisy[i, ..., list(p)].unsqueeze(0)
permuted.append(permuted_batch)
permuted = torch.cat(permuted, dim=0)
_loss_b = LossPIT(permuted, sources).item()
assert np.allclose(_loss_a, _loss_b, atol=1e-6)
def test_combination_invariant_loss_tf():
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 5
Instances
Project Name: interactiveaudiolab/nussl
Commit Name: fa6f47e7aee228226421c52e61cce4e1ab4cc099
Time: 2020-03-15
Author: prem@u.northwestern.edu
File Name: tests/ml/test_loss.py
Class Name:
Method Name: test_permutation_invariant_loss_tf
Project Name: catalyst-team/catalyst
Commit Name: 41bb60a5b4c5d3d1624a18be33963479f85dc1a0
Time: 2020-12-13
Author: scitator@gmail.com
File Name: catalyst/metrics/tests/test_iou.py
Class Name:
Method Name: test_iou
Project Name: dmlc/dgl
Commit Name: 25ac33440334fd2fdfe3fe4e4dd3dd1428601a47
Time: 2021-01-24
Author: zhengda1936@gmail.com
File Name: python/dgl/distributed/graph_services.py
Class Name:
Method Name: sample_neighbors