Ejemplo n.º 1
0
    def testBijectorForwardInverseWithHingeSoftnessEventDimsZero(self):
        with self.test_session():
            bijector = Softplus(hinge_softness=1.5)
            x = 2 * rng.randn(2, 10)
            y = 1.5 * self._softplus(x / 1.5)

            self.assertAllClose(y, bijector.forward(x).eval())
            self.assertAllClose(x, bijector.inverse(y).eval())
Ejemplo n.º 2
0
  def testBijectorForwardInverseWithHingeSoftnessEventDimsZero(self):
    with self.test_session():
      bijector = Softplus(event_ndims=0, hinge_softness=1.5)
      x = 2 * rng.randn(2, 10)
      y = 1.5 * self._softplus(x / 1.5)

      self.assertAllClose(y, bijector.forward(x).eval())
      self.assertAllClose(x, bijector.inverse(y).eval())
Ejemplo n.º 3
0
    def testBijectorForwardInverseEventDimsOne(self):
        with self.test_session():
            bijector = Softplus()
            self.assertEqual("softplus", bijector.name)
            x = 2 * rng.randn(2, 10)
            y = self._softplus(x)

            self.assertAllClose(y, bijector.forward(x).eval())
            self.assertAllClose(x, bijector.inverse(y).eval())
Ejemplo n.º 4
0
  def testBijectorForwardInverseEventDimsOne(self):
    with self.test_session():
      bijector = Softplus(event_ndims=1)
      self.assertEqual("softplus", bijector.name)
      x = 2 * rng.randn(2, 10)
      y = self._softplus(x)

      self.assertAllClose(y, bijector.forward(x).eval())
      self.assertAllClose(x, bijector.inverse(y).eval())