Skip to content

Commit

Permalink
Test that scale_activation changes AffineCouplingTransform results
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisprangle committed Dec 1, 2021
1 parent b9af0da commit cd6e3b7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/transforms/coupling_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ def test_forward_inverse_are_consistent(self):
with self.subTest(shape=shape):
self.assert_forward_inverse_are_consistent(transform, inputs)

def test_scale_activation_has_an_effect(self):
for shape in self.shapes:
inputs = torch.randn(batch_size, *shape)
transform, mask = create_coupling_transform(
coupling.AffineCouplingTransform, shape
)
outputs_default, logabsdet_default = transform(inputs)
transform.scale_activation = coupling.AffineCouplingTransform.GENERAL_SCALE_ACTIVATION
outputs_general, logabsdet_general = transform(inputs)
with self.subTest(shape=shape):
self.assertNotEqual(outputs_default, outputs_general)
self.assertNotEqual(logabsdet_default, logabsdet_general)

class AdditiveTransformTest(TransformTest):
shapes = [[20], [2, 4, 4]]
Expand Down

0 comments on commit cd6e3b7

Please sign in to comment.