Пример #1
0
 def test_torch_different_beta(self):
     data = torch.tensor([[1.0], [3.0], [4.5]])
     expected = torch.tensor([[2.75], [2], [3.75]])
     mu = MixUpBatch(inputs="x", outputs=["x", "lambda"], alpha=1.0, mode="train", shared_beta=False)
     mu.build('torch')
     mu.beta = MyTorchBeta()
     output = mu.forward(data=[data], state={})
     self.assertTrue(is_equal(output[0], expected))
Пример #2
0
 def test_tf_shared_beta(self):
     data = tf.constant([[1.0], [3.0], [4.5]])
     expected = tf.constant([[2.75], [2], [3.75]])
     mu = MixUpBatch(inputs="x", outputs=["x", "lambda"], alpha=1.0, mode="train", shared_beta=True)
     mu.build('tf')
     mu.beta = MyTFBeta()
     output = mu.forward(data=[data], state={})
     self.assertTrue(is_equal(output[0], expected))