Beispiel #1
0
    def test_prelu_1d_broadcast(self):
        dcr = dc.prelu(self.dc_a, self.dc_slope_1)

        np.testing.assert_allclose(self.prelu_true_1,
                                   np.array(dcr.data()).astype(np.float32),
                                   rtol=1e-3,
                                   atol=1e-3)
Beispiel #2
0
    def test_prelu_2d_broadcast(self):
        dc_a_reshaped = dc.reshape(self.dc_a, (6, 4))

        np_test = self.prelu_true_1.copy()

        dc_test = dc.prelu(dc_a_reshaped, self.dc_slope_1)
        np.testing.assert_allclose(np_test.flatten(),
                                   np.array(dc_test.data()).astype(np.float32),
                                   rtol=1e-3,
                                   atol=1e-3)
Beispiel #3
0
    def test_prelu_3d(self):
        dc_a_reshaped = dc.reshape(self.dc_a, (2, 4, 3))
        dc_slope_reshaped = dc.reshape(self.dc_slope, (2, 4, 3))

        np_test = np.reshape(self.prelu_true, (2, 4, 3))

        dc_test = dc.prelu(dc_a_reshaped, dc_slope_reshaped)
        np.testing.assert_allclose(np_test.flatten(),
                                   np.array(dc_test.data()).astype(np.float32),
                                   rtol=1e-3,
                                   atol=1e-3)